<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Codrops &#187; images</title>
	<atom:link href="http://tympanus.net/codrops/tag/images/feed/" rel="self" type="application/rss+xml" />
	<link>http://tympanus.net/codrops</link>
	<description>Useful resources and inspiration for creative minds</description>
	<lastBuildDate>Thu, 23 May 2013 13:36:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Automatic Figure Numbering with CSS Counters</title>
		<link>http://tympanus.net/codrops/2013/05/02/automatic-figure-numbering-with-css-counters/</link>
		<comments>http://tympanus.net/codrops/2013/05/02/automatic-figure-numbering-with-css-counters/#comments</comments>
		<pubDate>Thu, 02 May 2013 08:39:10 +0000</pubDate>
		<dc:creator>Hugo Giraudel</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css counters]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[figure]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[images]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=14881</guid>
		<description><![CDATA[Learn about CSS counters, the figure element and how to combine both for automatically numbering figures in a web page.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/AutomaticFigureNumbering/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/05/Automatic-Figure-Numbering-with-CSS-Counters1.jpg" alt="Automatic-Figure-Numbering-with-CSS-Counters" width="580" height="315" class="alignnone size-full wp-image-14931" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/AutomaticFigureNumbering/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/AutomaticFigureNumbering/AutomaticFigureNumbering.zip">Download source</a></p>
<p>When writing articles, blog posts, tutorials, magazine entries or anything else, you will often want to include some images, charts, photographs, or even videos and code snippets to illustrate your content.</p>
<p>That being said, you will most likely want to attach some kind of caption to these elements, and perhaps number them so your readers can keep track of your thoughts.</p>
<p>And that&#8217;s exactly what we are going to do in today&#8217;s tutorial: combining the usage of the <code>&lt;figure&gt;</code> element with CSS counters to make your inserted elements (especially images) sexy as hell!</p>
<h3>The figure element</h3>
<p>The <code>&lt;figure&gt;</code> element is intended to be used along with the <code>&lt;figcaption&gt;</code> element to mark up images, illustrations, photos, diagrams and code snippets among other things. Here is what the spec says about this element:</p>
<blockquote><p>
The figure element represents a unit of content, optionally with a caption, that is self-contained, that is typically referenced as a single unit from the main flow of the document, and that can be moved away from the main flow of the document without affecting the document&#8217;s meaning.</p>
<footer><cite><a href="http://dev.w3.org/html5/markup/figure.html">W3C Specification</a></cite></footer>
</blockquote>
<p>Here is the basic markup for a figure:</p>
<pre class="brush:html">
&lt;figure&gt;
	&lt;img src="path/to/your/image.jpg" alt="" /&gt;
	&lt;figcaption&gt;Here is the legend for your image&lt;figcaption&gt;
&lt;/figure&gt;
</pre>
<p>Here are a few notes regarding the figure element:</p>
<ul>
<li>The <code>&lt;figcaption&gt;</code> element is optional</li>
<li>You can only have one <code>&lt;figcaption&gt;</code> element in a <code>&lt;figure&gt;</code> element</li>
<li>You can embed as many other elements as you want in a <code>&lt;figure&gt;</code> element</li>
<li>When dealing with an image, you can leave the <code>alt</code> attribute empty if you include a <code>&lt;figcaption&gt;</code> to prevent screen readers from reading twice the same content</li>
</ul>
<p>For more information about the <code>&lt;figure&gt;</code> element, I recommend you <a href="http://html5doctor.com/the-figure-figcaption-elements/">this great article from HTML5Doctor</a>. There is also <a href="https://developer.mozilla.org/en-US/docs/HTML/Element/figure">this entry at Mozilla Developer Network</a> and of course <a href="http://dev.w3.org/html5/markup/figure.html">the official specification</a>.</p>
<h4>Examples</h4>
<p>For example, if you want to show a snippet of code, you can do it this way with the <code>&lt;figure&gt;</code> element:</p>
<pre class="brush:html">
&lt;figure&gt;
	&lt;code&gt;body { background: white; }&lt;/code&gt;
	&lt;figcaption&gt;Some illustrated code with figure&lt;figcaption&gt;
&lt;/figure&gt;
</pre>
<p>Basically, instead of adding your images this way:</p>
<pre class="brush:html">
<!-- This is not good enough -->
&lt;img src="cute-kitty.jpg" alt="This is a cute kitty!" /&gt;
</pre>
<p>&#8230; you can do something like this:</p>
<pre class="brush:html">
<!-- This is good and semantic -->
&lt;figure&gt;
	&lt;img src="cute-kitty.jpg" alt="" /&gt;
	&lt;figcaption&gt;This is a cute kitty!&lt;figcaption&gt;
&lt;figure&gt;
</pre>
<h4>Browser support</h4>
<p>The <code>&lt;figure&gt;</code> is part of the &#8220;new&#8221; HTML5 elements, which are not understood by a range of old browsers including Internet Explorer 8. Since you don&#8217;t want to make your layout explode because of this tutorial, I&#8217;d recommend you include a polyfill to support these elements.</p>
<p>The most known and used polyfill for HTML is <a href="https://code.google.com/p/html5shiv/">html5shiv</a> which you can embed directly from the <a href="http://html5shiv.googlecode.com/svn/trunk/html5.js">Google CDN</a> by adding this line into your files:</p>
<pre class="brush:html">&lt;!--[if IE lte 8]&gt;&lt;script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt;&lt;![endif]--&gt;</pre>
<p>Note, how we use IE-specific conditional comments to prevent other browsers and IE versions greater than 8 from loading this script.</p>
<p>If you wish to know the story behind the html5shiv polyfill, please read <a href="http://paulirish.com/2011/the-history-of-the-html5-shiv/">this wonderful blog post from Paul Irish</a>.</p>
<h3>CSS Counters</h3>
<p>CSS Counters have to be one of the most unknown CSS properties in the whole range of properties there is. It makes automatic numbering possible exclusively through CSS, without the help of neither HTML nor JavaScript.</p>
<p>This module relies on two properties and one value:</p>
<ul>
<li><code>counter-reset</code> which is used to initialize and reset one or several counters</li>
<li><code>counter-increment</code> which is used to increment one or several counters</li>
<li><code>counter()</code> is a valid value for <code>::before</code> and <code>::after</code> pseudo-elements, accepting a counter name as parameter in order to display its value</li>
</ul>
<p>Pretty straight forward, isn&#8217;t it? Basically, you initialize a counter with the name you want to the value you want (mostly 0) and you tell a given selector to increment this counter at each occurrence. This counter can then be displayed using CSS generated content and the style and location can be specified with the <code>:before</code> and <code>:after</code> pseudo-elements.</p>
<p>The most basic implementation of a CSS counter has to be this one:</p>
<pre class="brush:css">
/* 1. We initialize the counter */
body {
	counter-reset: myAwesomeCounter;
}

/* 2. We tell each occurrence of this element to increment the counter */
.myAwesomeElement {
	counter-increment: myAwesomeCounter;
}

/* 3. We display the value of the counter before the element */
.myAwesomeElement:before {
	content: counter(myAwesomeCounter);
}
</pre>
<p><em>Note: I lied when I said &#8220;2 properties and 1 value&#8221;, there is also a <code>counters()</code> value which is almost never used. Please refer to <a href="https://developer.mozilla.org/en-US/docs/CSS/Counters">this entry at MDN</a> for more information about it.</em></p>
<h4>Example</h4>
<p>Back to our case, shall we? We want to number our images so that they are prefixed by &#8220;Fig. 1 &#8211; &#8230;&#8221;, &#8220;Fig. 2 &#8211; &#8230;&#8221; and so on, right? Let&#8217;s do it simply.</p>
<pre class="brush:css">
.article {
	counter-reset: figures;
}

.figure {
	counter-increment: figures;
}

.figure figcaption:before {
	content: 'Fig. ' counter(figures) ' - ';
}
</pre>
<p>Those 3 lines of CSS are enough to number our figures automagically. Isn&#8217;t that awesome?</p>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<h3>Wrapping everything</h3>
<h4>The basics</h4>
<p>Now that we know how to use both the <code>&lt;figure&gt;</code> element and CSS Counters, it is time to make what we wanted to do: embellish our blog posts.</p>
<p>But before jumping into the code, wouldn&#8217;t it be cool if we could easily make floated or centered figures, just by adding a simple class? Sure, it would be. Let&#8217;s do this!</p>
<p>We will start by giving our figures some decent styles. Nothing too fancy, something simple and elegant enough to make a kind of frame to your images.</p>
<pre class="brush:css">
.figure {
	padding: 0.9em;
	border: 3px solid #f5bca8;
	background: #fff;
	margin: 0 auto 1em;
}
</pre>
<p>In order to horizontally center images and prevent them from breaking out of their container (the <code>&lt;figure&gt;</code> element), we need to add some rules to them (could as well be <code>&lt;video&gt;</code> or something else).</p>
<pre class="brush:css">
.figure img {
	margin: 0 auto;
	display: block;
	max-width: 100%;
}
</pre>
<p>Now the caption! We make it stand out a bit, change the typography and center it horizontally. But frankly the styling is up to you. Just remember a caption should be removed without too much hassle, so don&#8217;t write a wall of text.</p>
<pre class="brush:css">
.figure figcaption {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 2px;
	font-size: 0.8em;
	padding: .5em;
	text-align: center;
	color: #fff;
	background: #f5bca8;
}
</pre>
<h4>Numbering</h4>
<p>Great, we still haven&#8217;t implemented the counter to number our figures. As we&#8217;ve seen in the previous section, it is very easy to do.</p>
<pre class="brush:css">
.article {
	counter-reset: figures;
}

.figure figcaption {
	counter-increment: figures;
}

.figure figcaption:before {
	content: 'Fig. ' counter(figures) ' - ';
}
</pre>
<p>If you don&#8217;t necessarily want to number your images, you can limit this to a given class on the parent element. Perhaps you&#8217;ll give your wrapper a <code>.numbered-figures</code> class so that it enables image numbering. Easy enough:</p>
<pre class="brush:css">
.numbered-figures 							{ counter-reset: figures; }
.numbered-figures .figure figcaption 		{ counter-increment: figures; }
.numbered-figures .figure figcaption:before { content: 'Fig. ' counter(figures) ' - '; }
</pre>
<h4>Variations</h4>
<p>We have the basics for our system, but we still haven&#8217;t set up a way to have floated figures across the page. We will then make two classes:</p>
<pre class="brush:css">
.figure-left {
	float: left;
	margin: 0 1em .5em 0;
	width: -webkit-min-content;
	width: -moz-min-content;
	width: min-content;
}

.figure-right {
	float: right;
	margin: 0 0 .5em 1em;
	width: -webkit-min-content;
	width: -moz-min-content;
	width: min-content;
}
</pre>
<p>For those of you who do not know <code>min-content</code>, it is a valid value for <code>width</code>, <code>min-width</code>, <code>max-width</code>, <code>height</code>, <code>min-height</code> and <code>max-height</code> among other properties include flexbox and grid layout.</p>
<p>In our case, we want the figure element to be as small as possible; basically, we want it to wrap around the image. Because <code>&lt;figure&gt;</code> is a block-level element, it stretches to the width of its parent (100%). We could set it to <code>float: left</code> or <code>display: inline-block</code> to make it collapse to the widest piece of content but if the caption happens to be wider than the image we have a problem.</p>
<p>We could hard code the width to the figure element depending on the image, but it is inflexible and non-responsive. That&#8217;s why we introduce the <code>min-content</code> value. To put it simple, it tells the <code>&lt;figure&gt;</code> element to reduce its width so that the image fits inside it perfectly even if the caption has to wrap.</p>
<p>This value is supported by Firefox 3+ with the <code>-moz-</code> prefix and Chrome 18+ with the <code>-webkit-</code> prefix. The unprefixed version is currently not supported by any browser but might be in the future so we leave it.</p>
<p>Non-supportive browsers behave as expected: no width is set, the floated <code>&lt;figure&gt;</code> element wraps around the widest element, either the image or the caption.</p>
<p><em>Note: there are other values similar to <code>min-content</code> like <code>max-content</code>, <code>fit-content</code> and <code>available</code>. Please refer to <a href="https://developer.mozilla.org/en-US/docs/CSS/width">this entry at MDN</a> or the working draft of <a href="http://www.w3.org/TR/css3-sizing/">CSS Intrinsic &amp; Extrinsic Sizing Module Level 3</a>for further information about these.</em></p>
<p>Last but not least, we need to change/remove the max-width value on images for floated figures. Either you want images to have their own size, and you need to set max-width to <code>none</code>, or you want to set a maximum width (which I recommend) and you define whatever you want:</p>
<pre class="brush:css">
.figure-right img,
.figure-left img {
	max-width: 300px; /* Adjust to suit your needs */
}
</pre>
<h4>Small screens</h4>
<p>To make sure floated figures don&#8217;t behave oddly on small screens, we need to override a couple of styles to make them full-width and horizontally centered. If you&#8217;re building your site using a mobile first approach, you&#8217;ll do it the other way but it doesn&#8217;t matter really.</p>
<pre class="brush:css">
@media (max-width: 767px) {
	.figure-left,
	.figure-right {
		float: none;
		margin: 0 0 1em 0;
		width: 100%;
	}

	.figure img {
		max-width: 100%;
	}
}
</pre>
<h4>Usage</h4>
<p>Using this is easy as a pie. Either you want an horizontally centered figure in which case you simply have to use the <code>.figure</code> class. Or &mdash; most likely &mdash; you want to float the figure either on the left or on the right in which case you have to use both the <code>.figure</code> class and a variation class (e.g <code>.figure-left</code>).</p>
<pre class="brush:html">
<!-- Horizontally centered figure -->
&lt;figure class='figure'&gt;
	&lt;img src="path/to/your/image.jpg" alt="" /&gt;
	&lt;figcaption&gt;Here is the legend for your image&lt;figcaption&gt;
&lt;/figure&gt;

<!-- Left floated figure -->
&lt;figure class='figure figure-left'&gt;
	&lt;img src="path/to/your/image.jpg" alt="" /&gt;
	&lt;figcaption&gt;Here is the legend for your image&lt;figcaption&gt;
&lt;/figure&gt;

<!-- Right floated figure -->
&lt;figure class='figure figure-right'&gt;
	&lt;img src="path/to/your/image.jpg" alt="" /&gt;
	&lt;figcaption&gt;Here is the legend for your image&lt;figcaption&gt;
&lt;/figure&gt;
</pre>
<h3>Final words</h3>
<p>That&#8217;s pretty much it guys, the only thing left to do is to implement this on your site. Please have a look at the associated <a href="http://tympanus.net/Tutorials/AutomaticFigureNumbering/">demo</a> to see what it looks like or see it live on <a href="http://hugogiraudel.com/2013/02/04/css-gradients/">my own site</a>.</p>
<p><strong>Thanks for reading and happy coding!</strong></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/AutomaticFigureNumbering/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/AutomaticFigureNumbering/AutomaticFigureNumbering.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2013/05/02/automatic-figure-numbering-with-css-counters/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Thumbnail Grid with Expanding Preview</title>
		<link>http://tympanus.net/codrops/2013/03/19/thumbnail-grid-with-expanding-preview/</link>
		<comments>http://tympanus.net/codrops/2013/03/19/thumbnail-grid-with-expanding-preview/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 12:15:34 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[preview]]></category>
		<category><![CDATA[thumbnail]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=14530</guid>
		<description><![CDATA[A tutorial on how to create a thumbnail grid with an expanding image preview similar to the effect seen on Google Images.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/ThumbnailGridExpandingPreview/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/03/ThumbnailGridExpandingPreview.jpg" alt="Thumbnail Grid with Expanding Preview" width="580" height="315" class="alignnone size-full wp-image-14533" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/ThumbnailGridExpandingPreview/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/ThumbnailGridExpandingPreview/ThumbnailGridExpandingPreview.zip">Download source</a></p>
<p>If you have searched images on Google recently, you might have noticed the interesting expanding preview for a larger image when you click on a thumbnail. It&#8217;s a really nice effect and it is very practical, making a search much easier. Today we want to show you how to create a similar effect on a thumbnail grid. The idea is to open a preview when clicking on a thumbnail and to show a larger image and some other content like a title, a description and a link. </p>
<p>The interesting part is to calculate the correct preview height and to scroll the page to the right position. We&#8217;ll expand the preview in a way so that we can see the respective thumbnail row and cover the rest of the remaining page. Note that we don&#8217;t use very large images for the preview in the demo so you might see a lot of empty space on large monitors. </p>
<p>The demo features some amazing artwork by <a href="http://cargocollective.com/jaimemartinez">Jaime Martinez</a>.</p>
<p>So let&#8217;s start! </p>
<h3>The Markup</h3>
<p>Initially, we need a thumbnail grid for which we will use an unordered list. Each list item will contain an anchor which will have several data attributes: </p>
<pre class="brush:html">
&lt;ul id="og-grid" class="og-grid"&gt;
	&lt;li&gt;
		&lt;a href="http://cargocollective.com/jaimemartinez/" data-largesrc="images/1.jpg" data-title="Azuki bean" data-description="Swiss chard pumpkin bunya nuts maize plantain aubergine napa cabbage soko coriander sweet pepper water spinach winter purslane shallot tigernut lentil beetroot."&gt;
			&lt;img src="images/thumbs/1.jpg" alt="img01"/&gt;
		&lt;/a&gt;
	&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="http://cargocollective.com/jaimemartinez/" data-largesrc="images/2.jpg" data-title="Veggies sunt bona vobis" data-description="Komatsuna prairie turnip wattle seed artichoke mustard horseradish taro rutabaga ricebean carrot black-eyed pea turnip greens beetroot yarrow watercress kombu."&gt;
			&lt;img src="images/thumbs/2.jpg" alt="img02"/&gt;
		&lt;/a&gt;
	&lt;/li&gt;
	&lt;li&gt;&lt;!-- ... --&gt;&lt;/li&gt;
	&lt;!-- ... --&gt;
&lt;/ul&gt;
</pre>
<p>The <code>href</code> value will be used to construct the link in the preview description (this also comes in handy when JavaScript is disabled). The <code>data-largesrc</code> attribute contains the path to the larger image. <code>data-title</code> and <code>data-description</code> contain the title and description, respectively.</p>
<p>When we click on a thumbnail, we want a preview element to appear under the list item. For that we will need to insert an element into the grid. In fact, we will use the list item itself and add the preview element after the anchor:</p>
<pre class="brush:html">
&lt;li&gt;

	&lt;a href="http://cargocollective.com/jaimemartinez/" data-largesrc="images/2.jpg" data-title="Veggies sunt bona vobis" data-description="Komatsuna prairie turnip wattle seed artichoke mustard horseradish taro rutabaga ricebean carrot black-eyed pea turnip greens beetroot yarrow watercress kombu."&gt;
		&lt;img src="images/thumbs/2.jpg" alt="img02"/&gt;
	&lt;/a&gt;
	
	&lt;div class="og-expander"&gt;
		&lt;div class="og-expander-inner"&gt;
			&lt;span class="og-close"&gt;&lt;/span&gt;
			&lt;div class="og-fullimg"&gt;
				&lt;div class="og-loading"&gt;&lt;/div&gt;
				&lt;img src="images/2.jpg"&gt;
			&lt;/div&gt;
			&lt;div class="og-details"&gt;
				&lt;h3&gt;Veggies sunt bona vobis&lt;/h3&gt;
				&lt;p&gt;Komatsuna prairie turnip wattle seed artichoke mustard horseradish taro rutabaga ricebean carrot black-eyed pea turnip greens beetroot yarrow watercress kombu.&lt;/p&gt;
				&lt;a href="http://cargocollective.com/jaimemartinez/"&gt;Visit website&lt;/a&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;

&lt;/li&gt;
</pre>
<p>Let&#8217;s style everything!</p>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<h3>The CSS</h3>
<p><em>Note that the CSS will not contain any vendor prefixes, but you will find them in the files.</em></p>
<p>So, let&#8217;s start with the thumbnail grid. It will be full width and we&#8217;ll center the text. In this case this will mean that it will center the thumbnails because we&#8217;ll set them to <code>display: inline-block</code>:</p>
<pre class="brush:css">
.og-grid {
	list-style: none;
	padding: 20px 0;
	margin: 0 auto;
	text-align: center;
	width: 100%;
}

.og-grid li {
	display: inline-block;
	margin: 10px 5px 0 5px;
	vertical-align: top;
	height: 250px;
}
</pre>
<p>The links and images will be displayed as block elements and we&#8217;ll remove some default styling:</p>
<pre class="brush:css">
.og-grid li > a,
.og-grid li > a img {
	border: none;
	outline: none;
	display: block;
	position: relative;
}
</pre>
<p>When we click on an item, we will give a special class to the respective list item which will be called <code>og-expanded</code>. We&#8217;ll add a little arrow as pseudo-element to the anchor:</p>
<pre class="brush:css">
.og-grid li.og-expanded > a::after {
	top: auto;
	border: solid transparent;
	content: " ";
	height: 0;
	width: 0;
	position: absolute;
	pointer-events: none;
	border-bottom-color: #ddd;
	border-width: 15px;
	left: 50%;
	margin: -20px 0 0 -15px;
}
</pre>
<p>The preview itself will have the class <code>og-expander</code> and we&#8217;ll position that element absolutely. The initial height of the preview will be 0 and we&#8217;ll set the overflow to hidden:</p>
<pre class="brush:css">
.og-expander {
	position: absolute;
	background: #ddd;
	top: auto;
	left: 0;
	width: 100%;
	margin-top: 10px;
	text-align: left;
	height: 0;
	overflow: hidden;
}

.og-expander-inner {
	padding: 50px 30px;
	height: 100%;
}

</pre>
<p>The inner division will have some paddings and a height of 100%.</p>
<p>The cross for closing the preview will be created using pseudo-elements, i.e. two rotated lines:</p>
<pre class="brush:css">
.og-close {
	position: absolute;
	width: 40px;
	height: 40px;
	top: 20px;
	right: 20px;
	cursor: pointer;
}

.og-close::before,
.og-close::after {
	content: '';
	position: absolute;
	width: 100%;
	top: 50%;
	height: 1px;
	background: #888;
	transform: rotate(45deg);
}

.og-close::after {
	transform: rotate(-45deg);
}

.og-close:hover::before,
.og-close:hover::after {
	background: #333;
}
</pre>
<p>The wrappers for the image and for the details will be 50% wide and we&#8217;ll make them float next to each other:</p>
<pre class="brush:css">
.og-fullimg,
.og-details {
	width: 50%;
	float: left;
	height: 100%;
	overflow: hidden;
	position: relative;
}
</pre>
<p>The details wrapper will have some padding and we&#8217;ll center the image inside of the image wrapper by setting the text-align to center and the image itself to <code>display: inline-block</code>. The image will also have a max-height and max-width of 100% so that it adjusts its size to the surrounding container:</p>
<pre class="brush:css">
.og-details {
	padding: 0 40px 0 20px;
}

.og-fullimg {
	text-align: center;
}

.og-fullimg img {
	display: inline-block;
	max-height: 100%;
	max-width: 100%;
}

</pre>
<p>Let&#8217;s style the text elements and the link:</p>
<pre class="brush:css">
.og-details h3 {
	font-weight: 300;
	font-size: 52px;
	padding: 40px 0 10px;
	margin-bottom: 10px;
}

.og-details p {
	font-weight: 400;
	font-size: 16px;
	line-height: 22px;
	color: #999;
}

.og-details a {
	font-weight: 700;
	font-size: 16px;
	color: #333;
	text-transform: uppercase;
	letter-spacing: 2px;
	padding: 10px 20px;
	border: 3px solid #333;
	display: inline-block;
	margin: 30px 0 0;
	outline: none;
}

.og-details a::before {
	content: '\2192';
	display: inline-block;
	margin-right: 10px;
}

.og-details a:hover {
	border-color: #999;
	color: #999;
}
</pre>
<p>The loading element will be in the same container as the image and we&#8217;ll not use any images but this CSS-only technique. We&#8217;ll create a little circle and set three box shadows: one for making the circle itself look a bit smoother and two for &#8220;copying&#8221; the element. Then we create an animation that will change the background color and the box shadow colors sequentially:</p>
<pre class="brush:css">
.og-loading {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #ddd;
	box-shadow: 0 0 1px #ccc, 15px 30px 1px #ccc, -15px 30px 1px #ccc;
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -25px 0 0 -25px;
	animation: loader 0.5s infinite ease-in-out both;
}

@keyframes loader {
	0% { background: #ddd; }
	33% { background: #ccc; box-shadow: 0 0 1px #ccc, 15px 30px 1px #ccc, -15px 30px 1px #ddd; }
	66% { background: #ccc; box-shadow: 0 0 1px #ccc, 15px 30px 1px #ddd, -15px 30px 1px #ccc; }
}

</pre>
<p>Last, but not least, we&#8217;ll add two media queries for adjusting the text a bit and for hiding the full image once the screen gets so small that the preview image is not really useful anymore (we&#8217;ll also not load it in the JavaScript then).</p>
<pre class="brush:css">

@media screen and (max-width: 830px) {

	.og-expander h3 { font-size: 32px; }
	.og-expander p { font-size: 13px; }
	.og-expander a { font-size: 12px; }

}

@media screen and (max-width: 650px) {

	.og-fullimg { display: none; }
	.og-details { float: none; width: 100%; }
	
}
</pre>
<p>That&#8217;s all the style. Now, let&#8217;s take a look at the JavaScript.</p>
<h3>The JavaScript</h3>
<p>Let&#8217;s start by caching some elements and initializing some variables:</p>
<pre class="brush:js">
	// list of items
var $grid = $( '#og-grid' ),
	// the items
	$items = $grid.children( 'li' ),
	// current expanded item´s index
	current = -1,
	// position (top) of the expanded item
	// used to know if the preview will expand in a different row
	previewPos = -1,
	// extra amount of pixels to scroll the window
	scrollExtra = 0,
	// extra margin when expanded (between the preview element and the next item row)
	marginExpanded = 10,
	$window = $( window ), winsize,
	$body = $( 'html, body' ),
	// transitionend events
	transEndEventNames = {
		'WebkitTransition' : 'webkitTransitionEnd',
		'MozTransition' : 'transitionend',
		'OTransition' : 'oTransitionEnd',
		'msTransition' : 'MSTransitionEnd',
		'transition' : 'transitionend'
	},
	transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ],
	// support for csstransitions
	support = Modernizr.csstransitions,
	// default settings
	settings = {
		minHeight : 500,
		speed : 350,
		easing : 'ease'
	};
</pre>
<p>We will start by preloading all the images (thumbnails) in the grid. We then save the offset top and height for each item in the grid, get the current window&#8217;s size, and initialize some events: </p>
<pre class="brush:js">
	function init( config ) {
		
		// the settings..
		settings = $.extend( true, {}, settings, config );

		// preload all images
		$grid.imagesLoaded( function() {

			// save item´s size and offset
			saveItemInfo( true );
			// get window´s size
			getWinSize();
			// initialize some events
			initEvents();

		} );

	}

	// saves the item´s offset top and height (if saveheight is true)
	function saveItemInfo( saveheight ) {
		$items.each( function() {
			var $item = $( this );
			$item.data( 'offsetTop', $item.offset().top );
			if( saveheight ) {
				$item.data( 'height', $item.height() );
			}
		} );
	}

	function getWinSize() {
		winsize = { width : $window.width(), height : $window.height() };
	}
</pre>
<p>We will bind the click event for each item (anchor) and for the close button (when the item is opened). When we click on an item, the preview with the large image source and the details will be revealed or hidden if already shown. If we click the close button (cross) on the preview then this preview will be closed too.<br />
We are also binding the resize event for the window, where some values are reset and the preview gets closed (if opened).</p>
<pre class="brush:js">
	function initEvents() {
		
		// when clicking an item, show the preview with the item´s info and large image;
		// close the item if already expanded.
		// also close if clicking on the item´s cross
		$items.on( 'click', 'span.og-close', function() {
			hidePreview();
			return false;
		} ).children( 'a' ).on( 'click', function(e) {

			var $item = $( this ).parent();
			// check if item already opened
			current === $item.index() ? hidePreview() : showPreview( $item );
			return false;

		} );

		// on window resize get the window´s size again
		// reset some values..
		$window.on( 'debouncedresize', function() {
			
			scrollExtra = 0;
			previewPos = -1;
			// save item´s offset
			saveItemInfo();
			getWinSize();
			var preview = $.data( this, 'preview' );
			if( typeof preview != 'undefined' ) {
				hidePreview();
			}

		} );

	}
</pre>
<p>With the <em>showPreview</em> function we will basically initialize the Preview object, which in turn will expand and reveal the details and the large version of the image. If a Preview instance is already initialized then we will only update the preview with the new details (if the clicked item is in the same row as the current expanded item) or hide it and initialize / open a new one (if not in the same row).<br />
In order to check if the items are in the same row as the current preview, we use the offset top value of the items. </p>
<pre class="brush:js">
	function showPreview( $item ) {

		var preview = $.data( this, 'preview' ),
			// item´s offset top
			position = $item.data( 'offsetTop' );

		scrollExtra = 0;

		// if a preview exists and previewPos is different (different row) from item´s top, then close it
		if( typeof preview != 'undefined' ) {

			// not in the same row
			if( previewPos !== position ) {
				// if position > previewPos then we need to take the current preview´s height in consideration when scrolling the window
				if( position > previewPos ) {
					scrollExtra = preview.height;
				}
				hidePreview();
			}
			// same row
			else {
				preview.update( $item );
				return false;
			}
			
		}

		// update previewPos
		previewPos = position;
		// initialize new preview for the clicked item
		preview = $.data( this, 'preview', new Preview( $item ) );
		// expand preview overlay
		preview.open();

	}
</pre>
<p>The Preview object will have a reference to the currently displayed item (Preview.$item), and the index of the expanded item (Preview.expandedIdx). Note that the expanded item is not necessarily the displayed item. For instance if we click on a second item that is on the same row as the one clicked before then the Preview will be &#8220;reused&#8221; and the Preview.expandedIdx will not be the index of the Preview.$item. We need to keep the reference to the expanded item so that when the Preview is closed we know which item to &#8220;collapse&#8221;. </p>
<pre class="brush:js">
	// the preview obj / overlay
	function Preview( $item ) {
		this.$item = $item;
		this.expandedIdx = this.$item.index();
		this.create();
		this.update();
	}
</pre>
<p>As the Preview object is initialized we create the necessary structure where the item´s details will be rendered and we append it to the item:</p>
<pre class="brush:js">
	create : function() {
		// create Preview structure:
		this.$title = $( '&lt;h3&gt;&lt;/h3&gt;' );
		this.$description = $( '&lt;p&gt;&lt;/p&gt;' );
		this.$href = $( '&lt;a href="#"&gt;Visit website&lt;/a&gt;' );
		this.$details = $( '&lt;div class="og-details"&gt;&lt;/div&gt;' ).append( this.$title, this.$description, this.$href );
		this.$loading = $( '&lt;div class="og-loading"&gt;&lt;/div&gt;' );
		this.$fullimage = $( '&lt;div class="og-fullimg"&gt;&lt;/div&gt;' ).append( this.$loading );
		this.$closePreview = $( '&lt;span class="og-close"&gt;&lt;/span&gt;' );
		this.$previewInner = $( '&lt;div class="og-expander-inner"&gt;&lt;/div&gt;' ).append( this.$closePreview, this.$fullimage, this.$details );
		this.$previewEl = $( '&lt;div class="og-expander"&gt;&lt;/div&gt;' ).append( this.$previewInner );
		// append preview element to the item
		this.$item.append( this.getEl() );
		// set the transitions for the preview and the item
		if( support ) {
			this.setTransition();
		}
	}
</pre>
<p>Then we fill the previous structure with the item´s details (stored in data attributes and the href).<br />
The update function will also be used to just update the content of an existing preview.</p>
<pre class="brush:js">
	update : function( $item ) {

		// update with new item´s details 
		if( $item ) {
			this.$item = $item;
		}
		
		// if already expanded, remove class "og-expanded" from current item and add it to new item
		if( current !== -1 ) {
			var $currentItem = $items.eq( current );
			$currentItem.removeClass( 'og-expanded' );
			this.$item.addClass( 'og-expanded' );
			// position the preview correctly
			this.positionPreview();
		}

		// update current value
		current = this.$item.index();

		// update preview´s content
		var $itemEl = this.$item.children( 'a' ),
			eldata = {
				href : $itemEl.attr( 'href' ),
				largesrc : $itemEl.data( 'largesrc' ),
				title : $itemEl.data( 'title' ),
				description : $itemEl.data( 'description' )
			};

		this.$title.html( eldata.title );
		this.$description.html( eldata.description );
		this.$href.attr( 'href', eldata.href );

		var self = this;
		
		// remove the current image in the preview
		if( typeof self.$largeImg != 'undefined' ) {
			self.$largeImg.remove();
		}

		// preload large image and add it to the preview
		// for smaller screens we don´t display the large image (the last media query will hide the wrapper of the image)
		if( self.$fullimage.is( ':visible' ) ) {
			this.$loading.show();
			$( '&lt;img/&gt;' ).load( function() {
				self.$loading.hide();
				self.$largeImg = $( this ).fadeIn( 350 );
				self.$fullimage.append( self.$largeImg );
			} ).attr( 'src', eldata.largesrc );	
		}

	}
</pre>
<p>To reveal the preview we need to set the height of the Preview element and also of the item (to push down the items below). The height of the preview will be the window´s height minus the height of the grid item. To avoid cases where that height could be too small we add the option &#8220;minHeight&#8221; where we can specify the minimum height needed for the preview element.<br />
As the preview opens we will want to scroll the window so that the preview is completely visible (and if possible, also the item).</p>
<pre class="brush:js">
	open : function() {

		setTimeout( $.proxy( function() {	
			// set the height for the preview and the item
			this.setHeights();
			// scroll to position the preview in the right place
			this.positionPreview();
		}, this ), 25 );

	}

	setHeights : function() {

		var self = this,
			onEndFn = function() {
				if( support ) {
					self.$item.off( transEndEventName );
				}
				self.$item.addClass( 'og-expanded' );
			};

		this.calcHeight();
		this.$previewEl.css( 'height', this.height );
		this.$item.css( 'height', this.itemHeight ).on( transEndEventName, onEndFn );

		if( !support ) {
			onEndFn.call();
		}

	}

	calcHeight : function() {

		var heightPreview = winsize.height - this.$item.data( 'height' ) - marginExpanded,
			itemHeight = winsize.height;

		if( heightPreview < settings.minHeight ) {
			heightPreview = settings.minHeight;
			itemHeight = settings.minHeight + this.$item.data( 'height' ) + marginExpanded;
		}

		this.height = heightPreview;
		this.itemHeight = itemHeight;

	}

	positionPreview : function() {

		// scroll page
		// case 1 : preview height + item height fits in window´s height
		// case 2 : preview height + item height does not fit in window´s height and preview height is smaller than window´s height
		// case 3 : preview height + item height does not fit in window´s height and preview height is bigger than window´s height
		var position = this.$item.data( 'offsetTop' ),
			previewOffsetT = this.$previewEl.offset().top - scrollExtra,
			scrollVal = this.height + this.$item.data( 'height' ) + marginExpanded <= winsize.height ? position : this.height < winsize.height ? previewOffsetT - ( winsize.height - this.height ) : previewOffsetT;
		
		$body.animate( { scrollTop : scrollVal }, settings.speed );

	}
</pre>
<p>When closing the preview we reset the heights of the preview element and the expanded item. Once this is done, the preview element / structure gets removed from the DOM.</p>
<pre class="brush:js">
	close : function() {

		var self = this,
			onEndFn = function() {
				if( support ) {
					$( this ).off( transEndEventName );
				}
				self.$item.removeClass( 'og-expanded' );
				self.$previewEl.remove();
			};

		setTimeout( $.proxy( function() {

			if( typeof this.$largeImg !== 'undefined' ) {
				this.$largeImg.fadeOut( 'fast' );
			}
			this.$previewEl.css( 'height', 0 );
			// the current expanded item (might be different from this.$item)
			var $expandedItem = $items.eq( this.expandedIdx );
			$expandedItem.css( 'height', $expandedItem.data( 'height' ) ).on( transEndEventName, onEndFn );

			if( !support ) {
				onEndFn.call();
			}

		}, this ), 25 );
		
		return false;

	}
</pre>
<p>And that's it! We hope you enjoyed this tutorial and find it inspiring! </p>
<p><!--div class="ct-github-link"><a href="https://github.com/codrops/ThumbnailGridExpandingPreview">Find this project on Github</a></div-->
<p><a class="demo" href="http://tympanus.net/Tutorials/ThumbnailGridExpandingPreview/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/ThumbnailGridExpandingPreview/ThumbnailGridExpandingPreview.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2013/03/19/thumbnail-grid-with-expanding-preview/feed/</wfw:commentRss>
		<slash:comments>192</slash:comments>
		</item>
		<item>
		<title>Image Techniques for Creating Depth in Web Design</title>
		<link>http://tympanus.net/codrops/2013/02/27/image-techniques-for-creating-depth-in-web-design/</link>
		<comments>http://tympanus.net/codrops/2013/02/27/image-techniques-for-creating-depth-in-web-design/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 11:23:28 +0000</pubDate>
		<dc:creator>Carrie Cousins</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[depth]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[photography]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=14352</guid>
		<description><![CDATA[Creative manipulation of images, from layering to composition to special effects, can add depth to web projects.]]></description>
				<content:encoded><![CDATA[<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/ImageTechniques.jpg" alt="Image Techniques for Creating Depth in Web Design" width="580" height="315" class="alignnone size-full wp-image-14393" /></p>
<p>We live in a three-dimensional world, something that designers are trying to recreate in web design every day. The element of depth can add a greater touch of reality to certain design projects.</p>
<p>Creating it can be easier than you think. The key to simulating reality on the 2D screen is by creating depth using images. This can be accomplished in a variety of ways, from the photography itself, to layering of images, manipulation and the use of special effects.</p>
<h3>Layering</h3>
<p><a href="https://victoriabeckham.landrover.com/INT" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/rangerover.jpg" alt="rangerover" width="600" height="380" class="aligncenter size-full wp-image-14368" /></a></p>
<p><a href="http://www.mikedascola.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/mikedascola.jpg" alt="mikedascola" width="600" height="368" class="aligncenter size-full wp-image-14364" /></a></p>
<p><a href="http://www.adlucent.com/careers/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/adlucent.jpg" alt="adlucent" width="600" height="381" class="aligncenter size-full wp-image-14353" /></a></p>
<p><a href="http://www.gardenerandmarks.com.au/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/gardner.jpg" alt="gardner" width="600" height="378" class="aligncenter size-full wp-image-14360" /></a></p>
<p><a href="http://www.matteozanga.it/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/matteo.jpg" alt="matteo" width="600" height="377" class="aligncenter size-full wp-image-14363" /></a></p>
<p>Layering is a tool that can be intentionally used in the way images and objects are placed in the design process, as a tool to manipulate images or purposefully in the image itself.</p>
<p>We&#8217;ve all seen the layout where images are placed on top of each other haphazardly to look like a stack of printed photos. You know the trick. And it works by creating a sense of depth that makes you feel as if you are thumbing through the photographs. This is layering in the design process. Sometimes the effect is more obvious, as in this instance but other times it is more hidden.</p>
<p>Often multiple photos are merged into one to create two distinct parts of an image – a foreground and another background. When done well, the effect should be virtually unseen. Take a look at the Range Rover site above – both the car and the city images are spectacular and when combined they make you feel as if you are standing next to the vehicle looking over the city.</p>
<p>Another effective layering tool is laying a photograph or image over a seemingly flat background. This works fantastically with odd orientations or angled images and backgrounds that have graduated color.</p>
<p>Finally, some images are created with layering in mind. This photography technique is based on the idea of using overlapping lines created by different objects in the image to create depth. Often lines are emphasized by color and contrast in the image to separate objects in the scene from one another. This technique can be difficult for amateur photographers to create.</p>
<h3>Photography</h3>
<p><a href="http://sumisura.zegna.com/en" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/ermenegildo.jpg" alt="ermenegildo" width="600" height="379" class="aligncenter size-full wp-image-14358" /></a></p>
<p><a href="http://ownedition.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/ownedition.jpg" alt="ownedition" width="600" height="377" class="aligncenter size-full wp-image-14366" /></a></p>
<p><a href="http://www.hatshop.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/worth.jpg" alt="worth" width="600" height="379" class="aligncenter size-full wp-image-14371" /></a></p>
<p><a href="http://eng.charmerstudio.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/charmer.jpg" alt="charmer" width="600" height="334" class="aligncenter size-full wp-image-14354" /></a></p>
<p><a href="http://www.levehytter.no/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/hytter.jpg" alt="hytter" width="600" height="373" class="aligncenter size-full wp-image-14362" /></a></p>
<p><a href="http://premiumdraught.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/draught.jpg" alt="draught" width="600" height="292" class="aligncenter size-full wp-image-14356" /></a></p>
<p>One of the most important tools for creating depth is in the images. Framing and composing images with depth in mind can make building for depth a breeze. </p>
<p>But how do you compose photos in this manner? While many opt to hire a professional photographer and just provide instructions for depth, this is not always an option. If you are taking photos yourself for a project think about depth as you shoot with these tips.</p>
<p>Create a visual interest in the foreground. Make sure the photo has a subject and background. Thinking about these as separate parts will help you better frame and create an image.</p>
<p>Change the view. Take a photo from an unexpected angle. This changes the perspective of both the subject and background, adding visual dimension. You can also accomplish this by playing with angles; frame the same image from a comfortable level and with a wider angle.</p>
<p>Take photos in portrait orientation. By changing to a vertical axis, you will frame photos differently.</p>
<p>Think about natural lines and shadows. Sometimes what&#8217;s in the photo adds its own sense of depth. Distinct shadows, for example, can make an object come into sharper focus while extending the background.</p>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<h3>Image Manipulation</h3>
<p>Using photo editing software such as Adobe Photoshop, designers can create added depth in photos with a few simple tricks. This can be a great alternative when working with portraits or other images that were not shot with depth in mind.</p>
<p>The trick is this: With the subject in the foreground, add a blur to the background, while leaving the subject alone. (In Photoshop, a Gaussian blur adjusted to a radius of 5.0 works wonders.)<br />
This simple trick adds focus to the subject in an image while creating a sense of depth by making the background less of a visual priority.</p>
<h3>Shadow Effects</h3>
<p><a href="http://www.guestd.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/guestd.jpg" alt="guestd" width="600" height="381" class="aligncenter size-full wp-image-14361" /></a></p>
<p><a href="http://www.tylerfinck.com/upstatedesign/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/upstate.jpg" alt="upstate" width="600" height="333" class="aligncenter size-full wp-image-14370" /></a></p>
<p><a href="http://www.tokyo-milk.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/toykomilk.jpg" alt="toykomilk" width="600" height="344" class="aligncenter size-full wp-image-14369" /></a></p>
<p><a href="http://www.oyyo.se/no1/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/oyyo.jpg" alt="oyyo" width="600" height="363" class="aligncenter size-full wp-image-14367" /></a></p>
<p>Shadows are one of the easiest and most natural ways to create a sense of depth and place for objects and images. Placement, darkness and the shape of shadows can imply very specific meanings. They key for using shadows is for them to look natural. </p>
<p>The best shadows are subtle and follow patterns of light. Make sure shadows mirror the feel of images they accompany. If the first thing a user sees is the shadow, then it probably does not work. </p>
<p>Rounded shadows that rest below objects can create a floating, 3D-style effect. This is a common technique for buttons and smaller user interface elements. Shape-specific shadows in front of objects can make a flat item look like it is standing up, such as those on the Guest&#8217;d site. (Did you even notice the shadow before they were mentioned?) Warped shadows – those that do not mirror the shape of the image they relate to – can make an item appear to have another shape, or lift off a background image. </p>
<p>Shadows can also add a touch of realism to an object or item. A shadow behind a person can help lift him off the background, bringing the subject to the forefront of the image. This is a common technique but it is very important that shadows fall opposite of light sources in the image so that the end result appears natural and unforced.</p>
<h3>Illustrations and Other Images</h3>
<p><a href="http://emotionslive.co.uk/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/emotions.jpg" alt="emotions" width="600" height="336" class="aligncenter size-full wp-image-14357" /></a></p>
<p><a href="http://www.floridaflourish.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/flourish.jpg" alt="flourish" width="600" height="380" class="aligncenter size-full wp-image-14359" /></a></p>
<p><a href="http://www.dascolabarbers.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/dascola.jpg" alt="dascola" width="600" height="311" class="aligncenter size-full wp-image-14355" /></a></p>
<p><a href="http://www.webdesignbe.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2013/02/octi.jpg" alt="octi" width="600" height="377" class="aligncenter size-full wp-image-14365" /></a></p>
<p>The same concept and manipulations that work on photographs also work for illustrations and other images used in design projects. The difference is that you often have to create these effects yourself.</p>
<p>The dramatic shadow used above is a great example of this. The light and dark parts of the background relate specifically to the image, making it “move forward” from the rest of the site.</p>
<h3>Conclusion</h3>
<p>Depth is a great tool for creating a sense of realism in design projects. It can connect users to what they are viewing on the screen, making them feel like more of a part of the scene.</p>
<p>Even images, from photographs to vector-based user interface elements, that lack true depth can be manipulated to add a sense of having a third dimension. Layering, object orientation and shadows are some of the best tools for creating extra depth.</p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2013/02/27/image-techniques-for-creating-depth-in-web-design/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Using Transparency in Web Design: Dos and Don’ts</title>
		<link>http://tympanus.net/codrops/2012/11/26/using-transparency-in-web-design-dos-and-donts/</link>
		<comments>http://tympanus.net/codrops/2012/11/26/using-transparency-in-web-design-dos-and-donts/#comments</comments>
		<pubDate>Mon, 26 Nov 2012 14:22:12 +0000</pubDate>
		<dc:creator>Carrie Cousins</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[opacity]]></category>
		<category><![CDATA[transparency]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=12339</guid>
		<description><![CDATA[Experimenting with transparencies is a great way to expand your design repertoire. Like many other effects, use this technique sparingly and test the design in multiple environments to ensure that it works and looks as you intended.]]></description>
				<content:encoded><![CDATA[<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/UsingTransparencyinWebDesignDosandDonts.jpg" alt="Using Transparency in Web Design: Dos and Don’ts" title="Using Transparency in Web Design: Dos and Don’ts" width="580" height="315" class="alignnone size-full wp-image-12410" /></p>
<p>Creating a web design using transparency can be both beautiful and tricky. Transparency is the effect created when a color block, text or image is “made thinner” or desaturated so that the color is diluted and what is behind it shows through.</p>
<p>The effect can be quite stunning when executed properly – creating a great place for text or as a way to bring focus to a certain part of an image.</p>
<p>Designers must be careful though when using transparency. The effect can be tricky to do well, as readability is often a concern. Transparent boxes and text at the wrong levels can also be distracting and take away from the overall design.</p>
<p>Following is a set of dos and don&#8217;ts – with examples of sites executing transparency beautifully. </p>
<h3>Do Use Transparency to Create Contrast</h3>
<p><a href="http://www.decodesigninterior.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/deodesign.jpg" alt="" title="deodesign" width="580" height="398" class="aligncenter size-full wp-image-12344" /></a></p>
<p><a href="http://stevevorass.com/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/stevevorass.jpg" alt="" title="Stevevorass" width="580" height="350" class="alignnone size-full wp-image-12405" /></a></p>
<p><a href="http://www.teamtype1.org/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/sanofi.jpg" alt="" title="sanofi" width="580" height="404" class="aligncenter size-full wp-image-12352" /></a></p>
<p>The No. 1 benefit to using transparency as a design technique is to create contrast. The effect allows designers to establish a focal point with a clock of color, big text over an image or as a varying color screen with dimension. </p>
<p>Transparency can also be used to help text pop off a background that may not showcase it as well. </p>
<p>It is especially important to consider contrast when working with transparencies. A transparency will only work with both the image (or background) and text are readable. When considering a transparency effect, ask yourself: Will this make the text/image easier for users to understand? </p>
<h3>Don&#8217;t Cover Essential Parts of an Image</h3>
<p>Transparencies should not cover parts of the background or image beneath it that is important to the message. Be aware of what is “lost” when determining placement of transparent frames. </p>
<h3>Do Use Transparency in Varying Levels</h3>
<p><a href="http://www.ultimavez.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/ultima.jpg" alt="" title="ultima" width="580" height="403" class="aligncenter size-full wp-image-12357" /></a></p>
<p><a href="http://tunebow.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/tunebow.jpg" alt="" title="tunebow" width="580" height="398" class="aligncenter size-full wp-image-12356" /></a></p>
<p><a href="http://www.suavia.it/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/suavia.jpg" alt="" title="suavia" width="580" height="400" class="aligncenter size-full wp-image-12354" /></a></p>
<p><a href="http://getflywheel.com/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/flywheel.jpg" alt="" title="flywheel" width="580" height="350" class="alignnone size-full wp-image-12406" /></a></p>
<p>There is no perfect level of transparency. For some projects an 80 percent transparency is ideal; for others 15 percent may be best. Play with varying levels of transparencies for each project.</p>
<h3>Don&#8217;t Think Transparency Will Make Text Readable</h3>
<p>Just because you are using a transparent box for text does not mean the text is automatically readable. Think about contrast – both in terms of the transparent box to the text and from the background image to the transparent frame. </p>
<p>When using a transparency for images, colored boxes or text, it is vitally important to consider the readability of the words. Remember, your message will not be communicated if design effects render text illegible. </p>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<h3>Do Use Transparency in Small Spaces</h3>
<p><a href="http://webunder.com.au/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/webunder.jpg" alt="" title="webunder" width="580" height="360" class="aligncenter size-full wp-image-12358" /></a></p>
<p><a href="http://www.chichesterpahire.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/chichester.jpg" alt="" title="chichester" width="580" height="371" class="aligncenter size-full wp-image-12343" /></a></p>
<p><a href="http://line25.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/line25.jpg" alt="" title="line25" width="580" height="360" class="aligncenter size-full wp-image-12350" /></a></p>
<p>Transparencies are not just for the main part of your site. This effect can work great in small spaces as well.</p>
<p>Think about using a transparency to show off navigational tools or as a hover effect for buttons and clickable elements. Just try to not go too crazy with multiple transparencies. Pick an element and transparency style and stick to it throughout the site design.</p>
<h3>Don&#8217;t Place Transparency Over Images with Sharp Contrast</h3>
<p>Because of readability concerns, it is best to avoid using transparencies over items that already contain elements containing sharply contrasting elements – think pockets of black and white or colors that are opposites on the color wheel.</p>
<p>Using a transparency over these types of elements, unless really saturated can have a negative impact on your design because it can be difficult to create the correct effect across all parts of the background. Consider a tint box instead.</p>
<h3>Do Use Transparency as Art</h3>
<p><a href="http://www.explovent.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/explovent.jpg" alt="" title="explovent" width="580" height="395" class="aligncenter size-full wp-image-12349" /></a></p>
<p><a href="http://blog.squarespace.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/squarespace.jpg" alt="" title="squarespace" width="580" height="355" class="aligncenter size-full wp-image-12353" /></a></p>
<p><a href="http://www.tapparatus.com/isaidwhat/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/tapparatus.jpg" alt="" title="tapparatus" width="580" height="252" class="aligncenter size-full wp-image-12355" /></a></p>
<p>Transparencies are not just secondary effects. Consider creating a dominant image for your site using this effect.  </p>
<p>A large transparency can be a striking way to create contrast, emphasis and visual intrigue.</p>
<h3>Don&#8217;t Use Transparency as a Decoration</h3>
<p>Transparency is not an effect to add as an afterthought because you are bored with the design. Using this effect as a decoration is a surefire way to get into a design pickle.</p>
<p>The use of transparencies should be planned and thought out in advance. Transparency is not a simple effect such as bolding and can look sloppy and unprofessional if not done well.</p>
<h3>Do Use Transparency in the Background</h3>
<p><a href="http://www.exitzeroproject.org/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/exitzero.jpg" alt="" title="exitzero" width="580" height="398" class="aligncenter size-full wp-image-12348" /></a></p>
<p><a href="http://tonychester.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/chester.jpg" alt="" title="chester" width="580" height="402" class="aligncenter size-full wp-image-12342" /></a></p>
<p><a href="http://www.bressane.com/blog/ensaio-sensual-com-rayanne-morais/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/bressane.jpg" alt="" title="bressane" width="580" height="394" class="aligncenter size-full wp-image-12341" /></a></p>
<p>Transparent effects are not just for elements at the forefront of your design, this effect can be used on background images as well. Some of the best transparent elements are subtle.</p>
<p>Other transparencies may fall in between image layers. Tony Chester&#8217;s site for example uses a brilliant set of layering techniques with transparency to create a multi-dimensional design.</p>
<h3>Don&#8217;t Use Too Many Transparent Effects Simultaneously</h3>
<p>Limit use of different type of transparent effects to one per project. Transparencies should create distinction, contrast and visual interest. Using too much of a distinctive effect such as this one can be distracting for users.</p>
<h3>Do Use Transparency with Still and/or Rotating Images</h3>
<p><a href="http://www.pizzaza.ca/restaurant/bar_a_vin.php" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/pizzaza.jpg" alt="" title="pizzaza" width="580" height="400" class="aligncenter size-full wp-image-12351" /></a></p>
<p><a href="http://www.designblvd.nl/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/designblvd.jpg" alt="" title="designblvd" width="580" height="309" class="aligncenter size-full wp-image-12345" /></a></p>
<p><a href="http://www.designcollectors.com/ " target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/11/dsigncollectors.jpg" alt="" title="dsigncollectors" width="580" height="314" class="aligncenter size-full wp-image-12346" /></a></p>
<p>The use of transparencies is not limited to a single-page or still design. They can also work with varying images and backgrounds. Use transparencies in both ways.</p>
<p>Creating a transparency for rotating images can be one of the most tricky executions of the effect, but also one of the most impressive. Think about multiple background images careful. Choose images that have similar color and contrast schemes so that a single transparency will work while image backgrounds move behind it.</p>
<p>Pay careful attention to how the transparency fits over each image so that you maintain the integrity of each image, create a readable photo or other background and text and maintain visual consistency.</p>
<h3>Conclusion</h3>
<p>Experimenting with transparencies is a great way to expand your design repertoire. Like many other effects, use this technique sparingly and test the design in multiple environments to ensure that it works and looks as you intended.</p>
<p>The biggest challenges with transparency are creating it so that text is readable when interchanging images are used and ensuring that the transparent item does not cover the wrong parts of what is beneath it.</p>
<p>Experiment with different levels and uses of transparency – with images, with backgrounds, as a hover effect – to determine what works best for each project.</p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/11/26/using-transparency-in-web-design-dos-and-donts/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Elastislide Revised</title>
		<link>http://tympanus.net/codrops/2012/10/29/elastislide-revised/</link>
		<comments>http://tympanus.net/codrops/2012/10/29/elastislide-revised/#comments</comments>
		<pubDate>Mon, 29 Oct 2012 13:54:58 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[News & Updates]]></category>
		<category><![CDATA[carousel]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[responsive]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=11716</guid>
		<description><![CDATA[Elastislide, the responsive image carousel, has been updated and improved. It can be used vertically or horizontally and a minimun number of visible images can be specified.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/Elastislide/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/10/Elastislide_Revised.jpg" alt="" title="Elastislide Revised" width="580" height="315" class="alignnone size-full wp-image-11721" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/Elastislide/">View demo</a> <a class="download" href="http://tympanus.net/Development/Elastislide/Elastislide.zip">Download source</a></p>
<p>We&#8217;ve updated <a href="http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/" title="Elastislide – A Responsive jQuery Carousel Plugin" target="_blank">Elastislide, the responsive image carousel</a>. It has undergone some major changes with some improvements and we&#8217;ve added some new functionality. Take a look at the <a href="http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/">original article</a> to see how to use it and what options are available. </p>
<h3>Demos</h3>
<p>We&#8217;ve updated the demos and added some different examples:</p>
<p><strong><a href="http://tympanus.net/Development/Elastislide/index.html">Demo 1: A minimum of 3 (default) images are always visible.</a></strong><br />
<a href="http://tympanus.net/Development/Elastislide/index.html"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/10/Elastislide01.jpg" alt="Elastislide01" title="" width="580" height="264" class="alignnone size-full wp-image-11722" /></a></p>
<p><strong><a href="http://tympanus.net/Development/Elastislide/index2.html">Demo 2: Vertical with a minimum of 3 items visible.</a></strong><br />
<a href="http://tympanus.net/Development/Elastislide/index2.html"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/10/Elastislide02.jpg" alt="Elastislide02" title="" width="580" height="490" class="alignnone size-full wp-image-11723" /></a></p>
<p><strong><a href="http://tympanus.net/Development/Elastislide/index3.html">Demo 3: Fixed wrapper with a minimum of 2 images is always visible.</a></strong><br />
<a href="http://tympanus.net/Development/Elastislide/index3.html"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/10/Elastislide03.jpg" alt="Elastislide03" title="" width="580" height="228" class="alignnone size-full wp-image-11724" /></a></p>
<p><strong><a href="http://tympanus.net/Development/Elastislide/index4.html">Demo 4: Usage in an image gallery; a minimum of 4 images are visible.</a></strong><br />
<a href="http://tympanus.net/Development/Elastislide/index4.html"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/10/Elastislide04.jpg" alt="Elastislide04" title="" width="580" height="363" class="alignnone size-full wp-image-11725" /></a></p>
<div class="ct-github-link"><a href="https://github.com/codrops/Elastislide">Find this project on Github</a></div>
<h3>Summary of Changes</h3>
<ul>
<li>We have removed the options for the border and margin since we are relying on the border-box box-sizing, so make sure to include that:
<pre class="brush:css">
*,
*:after,
*:before {
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
}
</pre>
</li>
<li>Vertical or horizontal layout as an option</li>
<li>Unnecessary structural HTML has been removed</li>
<li>Several new public methods available: next(), previous(), slideStart() which moves the carousel to the beginning, slideEnd() which moves it to the end.</li>
<li>The image width does not need to be specified anymore.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/10/29/elastislide-revised/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
		<item>
		<title>Animated Responsive Image Grid</title>
		<link>http://tympanus.net/codrops/2012/08/02/animated-responsive-image-grid/</link>
		<comments>http://tympanus.net/codrops/2012/08/02/animated-responsive-image-grid/#comments</comments>
		<pubDate>Thu, 02 Aug 2012 16:28:22 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Playground]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[rotating]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=10139</guid>
		<description><![CDATA[A jQuery plugin for creating a responsive image grid that will switch images using different animations and timings. This can work nicely as a background or decorative element of a website since we can randomize the appearance of new images and their transitions.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/AnimatedResponsiveImageGrid/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/08/AnimatedResponsiveImageGrid.jpg" alt="Animated Responsive Image Grid" title="Animated Responsive Image Grid" width="580" height="315" class="alignnone size-full wp-image-10152" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/AnimatedResponsiveImageGrid/">View demo</a> <a class="download" href="http://tympanus.net/Development/AnimatedResponsiveImageGrid/AnimatedResponsiveImageGrid.zip">Download source</a></p>
<p>Today we want to share a jQuery plugin for creating a responsive image grid with you. The idea is to have a list of images and define the number of columns and rows which will arrange the images into a grid. The remaining images will appear with different animations and delays. With some sizing options we can define how the grid should be laid out for different screen widths.</p>
<p>This kind of component can work nicely as a background or decorative element of a website since we can randomize the appearance of new images and their transitions.</p>
<p>The beautiful images are by talented <a href="http://www.flickr.com/people/smanography/">Sherman Geronimo-Tan</a> and they are licensed under <a href="http://creativecommons.org/licenses/by/2.0/deed.en">Creative Commons Attribution 2.0 Generic (CC BY 2.0)</a>.</p>
<p>The HTML structure is simply an unordered list with anchors and images:</p>
<pre class="brush:html">
&lt;div id="ri-grid" class="ri-grid ri-grid-size-1 ri-shadow"&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;a href="#"&gt;&lt;img src="images/medium/1.jpg" alt="Whatever works"/&gt;&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="#"&gt;&lt;img src="images/medium/2.jpg" alt="Anything else"/&gt;&lt;/a&gt;&lt;/li&gt;
		&lt;!-- ... --&gt;
	&lt;/ul&gt;
&lt;/div&gt;
</pre>
<p>To call the plugin, simply do:</p>
<pre class="brush:js">
$(function() {
			
	$( '#ri-grid' ).gridrotator();

});
</pre>
<p>Don&#8217;t forget to include the other scripts that are needed. </p>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<h3>Options</h3>
<p>The following options are available:</p>
<pre class="brush:js">
// number of rows
rows			: 4,

// number of columns 
columns			: 10,

// rows/columns for different screen widths
// i.e. w768 is for screens smaller than 768 pixels
w1024			: {
	rows	: 3,
	columns	: 8
},

w768			: {
	rows	: 3,
	columns	: 7
},

w480			: {
	rows	: 3,
	columns	: 5
},

w320			: {
	rows	: 2,
	columns	: 4
},

w240			: {
	rows	: 2,
	columns	: 3
},

// step: number of items that are replaced at the same time
// random || [some number]
// note: for performance issues, the number should not be > options.maxStep
step			: 'random',
maxStep			: 3,

// prevent user to click the items
preventClick	: true,

// animation type
// showHide || fadeInOut || slideLeft || 
// slideRight || slideTop || slideBottom || 
// rotateLeft || rotateRight || rotateTop || 
// rotateBottom || scale || rotate3d || 
// rotateLeftScale || rotateRightScale || 
// rotateTopScale || rotateBottomScale || random
animType		: 'random',

// animation speed
animSpeed		: 500,

// animation easings
animEasingOut	: 'linear',
animEasingIn	: 'linear',

// the item(s) will be replaced every 3 seconds
// note: for performance issues, the time "can't" be < 300 ms
interval		: 3000,
// if false the animations will not start
// use false if onhover is true for example
slideshow		: true,
// if true the items will switch when hovered
onhover		: false,
// ids of elements that shouldn't change
nochange		: []
</pre>
<p>When defining the size of the grid, you should keep in mind that you will want to have less images in the grid than what you actually put in the list. Let's say you have a list of 50 images and define 5 columns and 4 rows. This will create a grid of 20 images with 30 left to be switched. </p>
<p>Check out the five demos with different configurations:</p>
<ul>
<li><a href="http://tympanus.net/Development/AnimatedResponsiveImageGrid/index.html"><strong>Demo 1:</strong> Random animations / 55% container width / 3s between switching</a></li>
<li><a href="http://tympanus.net/Development/AnimatedResponsiveImageGrid/index2.html"><strong>Demo 2:</strong> "fadeInOut" animation / 100% container width / 1 image switch at a time / 600ms between switching</a></li>
<li><a href="http://tympanus.net/Development/AnimatedResponsiveImageGrid/index3.html"><strong>Demo 3:</strong> Random animations / 100% container width / max. 2 images switch at a time / 2s between switching</a></li>
<li><a href="http://tympanus.net/Development/AnimatedResponsiveImageGrid/index4.html"><strong>Demo 4:</strong> Random animations / 55% container width / 3s between switching / elements 1,2,3 and 4 don't switch / clickable elements</a></li>
<li><a href="http://tympanus.net/Development/AnimatedResponsiveImageGrid/index5.html"><strong>Demo 5:</strong> rotateBottom animation / 55% container width / no slideshow / onhover true</a></li>
</ul>
<p><em>Thanks to Jesse Chase for sending us a similar idea and inspiring us.</em></p>
<p><strong>Hope you find this useful!</strong></p>
<div class="ct-github-link"><a href="https://github.com/codrops/AnimatedResponsiveImageGrid">Find this project on Github</a></div>
<p><a class="demo" href="http://tympanus.net/Development/AnimatedResponsiveImageGrid/">View demo</a> <a class="download" href="http://tympanus.net/Development/AnimatedResponsiveImageGrid/AnimatedResponsiveImageGrid.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/08/02/animated-responsive-image-grid/feed/</wfw:commentRss>
		<slash:comments>97</slash:comments>
		</item>
		<item>
		<title>Line That Up: Proper Alignment in Web Design</title>
		<link>http://tympanus.net/codrops/2012/06/19/line-that-up-proper-alignment-in-web-design/</link>
		<comments>http://tympanus.net/codrops/2012/06/19/line-that-up-proper-alignment-in-web-design/#comments</comments>
		<pubDate>Tue, 19 Jun 2012 14:06:03 +0000</pubDate>
		<dc:creator>Carrie Cousins</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[alignment]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=9597</guid>
		<description><![CDATA[Proper alignment techniques for text and other elements can add punch and readability to your website.]]></description>
				<content:encoded><![CDATA[<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/Alignment.jpg" alt="Line That Up: Proper Alignment in Web Design" title="Line That Up: Proper Alignment in Web Design" width="580" height="315" class="alignnone size-full wp-image-9611" /></p>
<p>Proper alignment of elements and text on your website greatly impact the overall design.</p>
<p>Meticulous alignment of elements, such as images and text blocks, adds an extra level of professionalism to your site and is visually appealing and calming. Choosing the proper alignment for text within each block can also add a sense of order and contributes to readability and overall design.</p>
<p>But it can sometimes be hard to choose how to align items. Think about your audience as you select how to align elements, especially type, and keep readability in mind as a key concern. When working with other elements consider how they will be used as you develop an outline for your site.</p>
<h3>Text</h3>
<p>There are several places alignment comes into play with text – for your banner, navigational tools, sidebars and main body text. Each of these elements could include text that is aligned in different ways, but you likely want to develop a consistent style within each text element type.</p>
<p>Text can be aligned in four distinct ways – left, right, center and justified. When selecting a default alignment for body type on your site, first think of the language type will be displayed in. Does it read from left to right, or right to left?</p>
<p><a href="http://www.chrislinden.com/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/chrislinden.jpg" alt="" title="chrislinden" width="580" height="388" class="aligncenter size-full wp-image-9600" /></a></p>
<p>Left aligned text is the default setting in most computer software and for building websites when no other text direction is set. Each line of text aligns with the left margin and is ragged along the right margin. Left justified text is the standard for main body text on most websites because it is easy to navigate, design and read. In web design, word spacing is most consistent with left alignment.</p>
<p><a href="http://x-doria.com/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/xdoria.jpg" alt="" title="xdoria" width="580" height="393" class="aligncenter size-full wp-image-9605" /></a></p>
<p>Right aligned text is the default setting for languages that read from right to left. Text aligns with the right margin and is jagged along the left side. Right justification appears most frequently in navigational elements or break out text blocks that are used more like art elements, such as big quotes.</p>
<p><a href="http://vool.me/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/vool.jpg" alt="" title="vool" width="580" height="317" class="aligncenter size-full wp-image-9604" /></a></p>
<p>Centered text is centered within the box it resides. Lines of type are typically jagged on both the right and left sides. Centering is most commonly used for text blocks containing few words.</p>
<p>Justified text stretches the entire width of a frame. While justified text is commonly used in print materials, it is uncommon in web design. The look of justified text can be somewhat hard to predict in different browser sizes. Further, because of the lack of defined hyphenation, text can squeeze and stretch somewhat more unpredictably, making readability an issue online.</p>
<h3>Images</h3>
<p><a href="http://www.itsnumbered.com/en/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/numbered.jpg" alt="" title="numbered" width="580" height="330" class="aligncenter size-full wp-image-9602" /></a></p>
<p><a href="http://www.nelsoncash.com/blog/2012/06/06/keeping-feedback-on-track/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/nelsoncash.jpg" alt="" title="nelsoncash" width="580" height="369" class="aligncenter size-full wp-image-9601" /></a></p>
<p>How you align images is relative to the size of each image and its relation to other elements on your site. Images can be aligned to the left or right margins or centered.</p>
<p>Commonly, display images are centered for maximum impact and to avoid having an abundance of dead space on one side or the other, in the way images are used on this website. The same is often true of images that are used as backgrounds. Display images are sometimes aligned to the left as well depending on how they pair with text or other elements; right-alignment for display images works in some instances but is not a commonly-used tool.</p>
<p>Smaller images offer much more flexibility in terms of alignment. Images that are inset in text blocks can be aligned to either the left or right. Aligning to the left margin creates simple clean lines with no jagged edges around images when paired with left-aligned text. Aligning to the right margin is a common alternative, with left-aligned text creating an uneven edge around the image. The one technique you will want to avoid is centering a small image inside a text block; this can make text very had to read. Do you read across or around the image?<br />
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div></p>
<h3>Groups of Elements</h3>
<p><a href="http://thekitchencommunity.com/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/thekitchen.jpg" alt="" title="thekitchen" width="580" height="381" class="aligncenter size-full wp-image-9603" /></a></p>
<p>By aligning elements in groups, even items that are different such as text and images, you add an extra level of organization and even professionalism to the look of your site. Note how the “The Kitchen” text block sits in alignment with the “What’s happening&#8221; block below it in the image above.</p>
<p>Keep in mind that all alignment is not in perfect squares. Items of different shapes and sizes can be aligned to a single plane for emphasis, making interesting shapes and groupings. As you can see in the image above, the effect you get when grouping the same elements with no common alignment is quite different. </p>
<h3>Mixed Alignments</h3>
<p><a href="http://www.bignoise.com/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/bignoise.jpg" alt="" title="bignoise" width="580" height="394" class="aligncenter size-full wp-image-9599" /></a></p>
<p>You don’t have to pick one type of alignment and stick to it for every part of your site design.</p>
<p>For text, you may choose to center navigation tools while using justified text for the main body copy. This can be a very effective use of alignment tools. The key is aligning common elements in the same way. Outline a plan for how text will be aligned for different parts of your site framework and stick to it.</p>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/06/alignment.jpg" alt="" title="alignment" width="580" height="248" class="aligncenter size-full wp-image-9598" /></p>
<p>For images, you may want to alter alignments. Maybe small photos could alternate between left- and right- justified positions for variety. This is a common and very effective practice. Make sure though, that all of your left- or right-aligned items fall along the same gridline. You can add even more emphasis in this configuration by sizing photos at the same widths to create a defined alignment scheme.</p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/06/19/line-that-up-proper-alignment-in-web-design/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Making Room to Breathe: Wrapping Text Around Elements</title>
		<link>http://tympanus.net/codrops/2012/05/15/making-room-to-breathe-wrapping-text-around-elements/</link>
		<comments>http://tympanus.net/codrops/2012/05/15/making-room-to-breathe-wrapping-text-around-elements/#comments</comments>
		<pubDate>Tue, 15 May 2012 12:52:07 +0000</pubDate>
		<dc:creator>Carrie Cousins</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[typography]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=9044</guid>
		<description><![CDATA[Text wrap can be a useful tool when embedding images into blocks of text and when used properly can add to your site’s readability.]]></description>
				<content:encoded><![CDATA[<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/Wrapping.jpg" alt="Making Room to Breathe: Wrapping Text Around Elements" title="Making Room to Breathe: Wrapping Text Around Elements" width="580" height="315" class="alignnone size-full wp-image-9086" /></p>
<p>I constantly look through websites and wonder why designers allow text and images to get a little too close. Why don’t the elements have room to breathe?</p>
<p>That’s where text- or word-wrapping comes in. Adding space above, below and to the sides of an object embedded in text can make a lot of difference in terms of overall look of your site and even readability.</p>
<h3>Wrapping Benefits</h3>
<p><a href="http://animaladay.blogspot.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/animal.jpg" alt="" title="animal" width="580" height="355" class="alignnone size-full wp-image-9045" /></a></p>
<p><a href="http://sillynate.blogspot.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/sillynate.jpg" alt="" title="sillynate" width="580" height="475" class="alignnone size-full wp-image-9054" /></a></p>
<p>The No. 1 reason to use text wrapping settings for images that touch text is to aid readability. The addition of white space around images gives text a cushion, making it easier on the eye. </p>
<p>Depending on your specs, text wrap can also add emphasis to images as well. By separating text and images both will more clearly stand out. </p>
<p>Whether text wrapping is even necessary depends on how your site is constructed. Blogs using a wide columnar design commonly use small photos embedded in text and rely on text wrap settings to make images and text work together. Many sites though have a modular construction that almost makes text wrap unnecessary because text and images are almost exclusively stacked and rarely appear side-by-side.</p>
<h3>How Much Wrap?</h3>
<p><a href="https://wantful.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/wantful.jpg" alt="" title="wantful" width="580" height="317" class="alignnone size-full wp-image-9056" /></a></p>
<p><a href="http://www.secondstory.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/secondstory.jpg" alt="" title="secondstory" width="580" height="283" class="alignnone size-full wp-image-9053" /></a></p>
<p>How much wrap to put around an image is a little trickier. Blogging sites and software (such as WordPress and Blogger) often have a set of defaults that will wrap text for you. The wrap specs correspond to the style template you select when you set up the blog.</p>
<p>These text wrap styles tend to be somewhat tight but typically work effectively for the blog-format. Standard text wraps typically allow for 5 or 6 pixels of space all the way around an image. Personally, this is a little tight for my taste. For a super clean text wrap style consider wrapping text so that the vertical space on either side of an image is equal to the horizontal space above and below the image. You can accomplish this by setting the text wrap specs to mirror the leading of the body copy.</p>
<p>Photo and text alignment can impact the look of text wrap as well. Wrap will always seem more consistent and intentional when it falls next to text that is justified (so that all lines start/stop at the same place. Wrap will appear looser when it falls alongside ragged text.</p>
<h3>Types of Wraps</h3>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/nowrap.jpg" alt="" title="nowrap" width="580" height="285" class="alignnone size-full wp-image-9052" /></p>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/squarewrap.jpg" alt="" title="squarewrap" width="580" height="285" class="alignnone size-full wp-image-9055" /></p>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/halowrap.jpg" alt="" title="halowrap" width="580" height="285" class="alignnone size-full wp-image-9048" /></p>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/jumpwrap.jpg" alt="" title="jumpwrap" width="580" height="285" class="alignnone size-full wp-image-9050" /></p>
<p>Text wrap typically appears in one of three ways – as a square-shaped box around an image, an oddly-shaped halo around an image to match the contours of the image (for non-square images) or as a wrap that knocks out all of the lines around an image (jump text wrap).</p>
<p><a href="http://weareimpero.com/" target="_blank"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/impero-1.jpg" alt="" title="impero-1" width="580" height="353" class="alignnone size-full wp-image-9049" /></a></p>
<p>Text wrap can occur outside of an object – to keep text from touching the borders of another frame – or inside of an object. Inside text wraps keep text contained within a frame, such as the text inside the black shape on the Impero site.</p>
<h3>Wrap Scenarios to Avoid</h3>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/cleanwrap.jpg" alt="" title="cleanwrap" width="580" height="285" class="alignnone size-full wp-image-9046" /></p>
<p><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/05/messywrap.jpg" alt="" title="messywrap" width="580" height="285" class="alignnone size-full wp-image-9051" /></p>
<p>Text wrap can cause readability issues if the wrap causes text to break poorly. Watch for very thin columns of text next to a wrap. You may want to rethink your photo size or placement if the wrap causes excessive hyphenation (aim for hyphens no more frequently than at the end of every three lines) or blank lines of text. (This happens when words can’t fit in the space left after the wrap is applied.)</p>
<p>Photo placement can also case wrapping concerns. Avoid having lots of jagged wraps throughout your page. Varying wrap widths and photo sizes can make for a jarring design. Instead, group many small images together and use a single wrap or use photos with equally-sized frames.</p>
<p>Consider alignment as well. Images and text wrap will appear more uniform if all of the images are placed in the same manner – to the left, center or right side of the text block. Centered images can be tough to wrap around because text will often break oddly around the object. Also using a left-aligned image and close to a right-aligned image can create an odd, difficult-to-read block of text squeezed between the images.</p>
<h3>Code</h3>
<p>When creating your own styles sheets, you might consider developing your own text wrap specs. You can apply classes that will create the desired alignment and spacing.</p>
<pre class="brush:html">
&lt;img src="images/flower.jpg" alt="A yellow rose" class="my-align-class" /&gt;
</pre>
<p>Where <strong>my-align-class</strong> could be one of the following:</p>
<pre class="brush:css">
.align_left {
	float: left; 
	margin-right: 1em;
	margin-bottom: 1em;
}

.align_right {
	float: right; 
	margin-left: 1em;
	margin-bottom: 1em;
}

.align_center {
	display: block; 
	margin-left: auto; 
	margin-right: auto;
}
</pre>
<p>For wrapping text around non-rectangular shapes, you can take a look at the following tools/techniques:</p>
<ul>
<li><a href="http://www.csstextwrap.com/">CSS Text Wrapper: Generate HTML/CSS to wrap content to any shape or curve</a></li>
<li><a href="http://www.torylawson.com/index.php?title=CSS_-_Wrapping_text_around_non-rectangular_shapes">CSS &#8211; Wrapping text around non-rectangular shapes</a></li>
</ul>
<h3>Conclusion</h3>
<p>Text wrap is a great thing to keep in your design toolbox. In particular, it works great on sites that have large blocks of text with small images scattered throughout.</p>
<p>But don’t just rely on a template for wrap settings. Play with the code and add more space (or even take away a few pixels) to create a style that works best for your site.</p>
<p>Consider alternatives to wrapping text. Instead of dropping an image into the text, let the image float above it (look at how the images and text wrap on this site).</p>
<p>Text wraps can be tricky. Successful wrapping depends on the size of image, size of text and with of column where everything lives. Make sure your wrap passes the eye test and text is easier, not more difficult to read, with the addition of a text wrap. </p>
<p><em>Images courtesy of <a href="http://www.flickr.com/photos/shine2002/3928026019/" target="_blank">soa2002</a> and <a href="http://www.flickr.com/photos/frankjuarez/461208642/" target="_blank">frankjuarez</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/05/15/making-room-to-breathe-wrapping-text-around-elements/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Sliding Image Panels with CSS3</title>
		<link>http://tympanus.net/codrops/2012/01/17/sliding-image-panels-with-css3/</link>
		<comments>http://tympanus.net/codrops/2012/01/17/sliding-image-panels-with-css3/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 12:51:47 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[background-image]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[general sibling selector]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[sliding]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=7286</guid>
		<description><![CDATA[Today we'll show you how to create some neat sliding image panels with CSS only. The idea is to use background images for the panels and animate them when clicking on a label. We'll use radio buttons with labels and target the respective panels with the general sibling selector. ]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/CSS3SlidingImagePanels/"><br />
<img class="alignnone size-full wp-image-7366" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2012/01/SlidingImagePanelsCss3_2.jpg" alt="SlidingImagePanelsCss3_2" width="580" height="315" /><br />
</a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3SlidingImagePanels/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3SlidingImagePanels/CSS3SlidingImagePanels.zip">Download source</a></p>
<p>Today we&#8217;ll show you how to create some neat sliding image panels with CSS only. The idea is to use background images for the panels and animate them when clicking on a label. We&#8217;ll use radio buttons with labels and target the respective panels with the general sibling selector.</p>
<p>The beautiful images are by <a href="http://www.behance.net/qstra">Joanna Kustra</a> and they are licensed under the <a href="http://creativecommons.org/licenses/by-nc/3.0/">Attribution-NonCommercial 3.0 Unported Creative Commons License</a>.</p>
<p>You might as well be interested in <a href="http://tympanus.net/codrops/2012/01/09/filter-functionality-with-css3/">Filter Functionality with CSS3 </a> where we have used a similar technique for filtering elements based on their type.</p>
<p><strong>Please note: the result of this tutorial will only work as intended in browsers that support CSS transitions and animations.</strong></p>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<h3>The Markup</h3>
<p>The HTML will consist of three major parts: the radio buttons and the labels, the container with the panels and their &#8220;slices&#8221; for each image, and the titles. The container with the class <strong>cr-bgimg</strong> part will have a division for each of the panels and inside we&#8217;ll place spans for every image with the right background position. So, the first panel will have four slices, each having the one of the images as background with the left-most position. The second panel will have again four slices but now the background position will be moved to be showing the next part of the respective image:</p>
<pre class="brush:xml">&lt;section class="cr-container"&gt;			

	&lt;!-- radio buttons and labels --&gt;
	&lt;input id="select-img-1" name="radio-set-1" type="radio" class="cr-selector-img-1" checked/&gt;
	&lt;label for="select-img-1" class="cr-label-img-1"&gt;1&lt;/label&gt;

	&lt;input id="select-img-2" name="radio-set-1" type="radio" class="cr-selector-img-2" /&gt;
	&lt;label for="select-img-2" class="cr-label-img-2"&gt;2&lt;/label&gt;

	&lt;input id="select-img-3" name="radio-set-1" type="radio" class="cr-selector-img-3" /&gt;
	&lt;label for="select-img-3" class="cr-label-img-3"&gt;3&lt;/label&gt;

	&lt;input id="select-img-4" name="radio-set-1" type="radio" class="cr-selector-img-4" /&gt;
	&lt;label for="select-img-4" class="cr-label-img-4"&gt;4&lt;/label&gt;

	&lt;div class="clr"&gt;&lt;/div&gt;	

	&lt;!-- panels --&gt;
	&lt;div class="cr-bgimg"&gt;
		&lt;div&gt;
			&lt;span&gt;Slice 1 - Image 1&lt;/span&gt;
			&lt;span&gt;Slice 1 - Image 2&lt;/span&gt;
			&lt;span&gt;Slice 1 - Image 3&lt;/span&gt;
			&lt;span&gt;Slice 1 - Image 4&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
			&lt;span&gt;Slice 2 - Image 1&lt;/span&gt;
			&lt;span&gt;Slice 2 - Image 2&lt;/span&gt;
			&lt;span&gt;Slice 2 - Image 3&lt;/span&gt;
			&lt;span&gt;Slice 2 - Image 4&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
			&lt;span&gt;Slice 3 - Image 1&lt;/span&gt;
			&lt;span&gt;Slice 3 - Image 2&lt;/span&gt;
			&lt;span&gt;Slice 3 - Image 3&lt;/span&gt;
			&lt;span&gt;Slice 3 - Image 4&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
			&lt;span&gt;Slice 4 - Image 1&lt;/span&gt;
			&lt;span&gt;Slice 4 - Image 2&lt;/span&gt;
			&lt;span&gt;Slice 4 - Image 3&lt;/span&gt;
			&lt;span&gt;Slice 4 - Image 4&lt;/span&gt;
		&lt;/div&gt;
	&lt;/div&gt;

	&lt;!-- titles --&gt;
	&lt;div class="cr-titles"&gt;
		&lt;h3&gt;
			&lt;span&gt;Serendipity&lt;/span&gt;
			&lt;span&gt;What you've been dreaming of&lt;/span&gt;
		&lt;/h3&gt;
		&lt;h3&gt;
			&lt;span&gt;Adventure&lt;/span&gt;
			&lt;span&gt;Where the fun begins&lt;/span&gt;
		&lt;/h3&gt;
		&lt;h3&gt;
			&lt;span&gt;Nature&lt;/span&gt;
			&lt;span&gt;Unforgettable eperiences&lt;/span&gt;
		&lt;/h3&gt;
		&lt;h3&gt;
			&lt;span&gt;Serenity&lt;/span&gt;
			&lt;span&gt;When silence touches nature&lt;/span&gt;
		&lt;/h3&gt;
	&lt;/div&gt;

&lt;/section&gt;</pre>
<p>The h3 elements for the titles will have two spans, one for the main headline and one for the sub-headline.</p>
<p>Let&#8217;s style this baby.</p>
<h3>The CSS</h3>
<p><em>I will omit all the vendor prefixes, but you will, of course, find them in the files.</em><br />
<em>We&#8217;ll be going through the style of demo 1.</em></p>
<p>Our aim is to first hide those radio buttons by covering them up with labels. In web browsers, clicking on a label will make the respective checkbox or radio button selected. Giving an ID to the input, we can use the <a href="http://www.w3.org/TR/html4/interact/forms.html#adef-for">for = idref</a> attribute of the label to reference the respective input.</p>
<p>Second, we want to place all the background images correctly and third, we want to show the respective image slices and titles when clicking on a label.</p>
<p>So, lets first syle the section and give it a white border with some subtle box box shadow:</p>
<pre class="brush:css">.cr-container{
	width: 600px;
	height: 400px;
	position: relative;
	margin: 0 auto;
	border: 20px solid #fff;
	box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
}</pre>
<p>Since we want to use the general sibling selector in order to &#8220;reach&#8221; the right image slices and titles, we need to place the labels before those containers. Let&#8217;s make sure that they are on top as a layer (z-index) and push its position down by adding a top margin of 350px;</p>
<pre class="brush:css">.cr-container label{
	font-style: italic;
	width: 150px;
	height: 30px;
	cursor: pointer;
	color: #fff;
	line-height: 32px;
	font-size: 24px;
	float:left;
	position: relative;
	margin-top: 350px;
	z-index: 1000;
}</pre>
<p>Let&#8217;s prettify the label by adding a little circle. We&#8217;ll create a pseudo element and place it centered behind the label text:</p>
<pre class="brush:css">.cr-container label:before{
	content:'';
	width: 34px;
	height: 34px;
	background: rgba(130,195,217,0.9);
	position: absolute;
	left: 50%;
	margin-left: -17px;
	border-radius: 50%;
	box-shadow: 0px 0px 0px 4px rgba(255,255,255,0.3);
	z-index:-1;
}</pre>
<p>In order to create a separation between the panels we&#8217;ll use a little trick. We&#8217;ll create another pseudo-element for the label and extend it to stretch over the panel. Using a gradient, we&#8217;ll make the line &#8220;fade out&#8221; at the top:</p>
<pre class="brush:css">.cr-container label:after{
	width: 1px;
	height: 400px;
	content: '';
	background: linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%);
	position: absolute;
	bottom: -20px;
	right: 0px;
}</pre>
<p>The last panel should not have that line so we simply give it 0 width:</p>
<pre class="brush:css">.cr-container label.cr-label-img-4:after{
	width: 0px;
}</pre>
<p>Now, that we&#8217;ve taken care of the label look, we can hide the inputs:</p>
<pre class="brush:css">.cr-container input{
	display: none;
}</pre>
<p>Whenever we click on a label, the respective input gets checked. Now we can target the respective label using the general sibling selector. So, we will change the color the &#8220;selected&#8221; label:</p>
<pre class="brush:css">.cr-container input.cr-selector-img-1:checked ~ label.cr-label-img-1,
.cr-container input.cr-selector-img-2:checked ~ label.cr-label-img-2,
.cr-container input.cr-selector-img-3:checked ~ label.cr-label-img-3,
.cr-container input.cr-selector-img-4:checked ~ label.cr-label-img-4{
	color: #68abc2;
}</pre>
<p>And we&#8217;ll also change the background color and box shadow of its cicle pseudo-element:</p>
<pre class="brush:css">.cr-container input.cr-selector-img-1:checked ~ label.cr-label-img-1:before,
.cr-container input.cr-selector-img-2:checked ~ label.cr-label-img-2:before,
.cr-container input.cr-selector-img-3:checked ~ label.cr-label-img-3:before,
.cr-container input.cr-selector-img-4:checked ~ label.cr-label-img-4:before{
	background: #fff;
	box-shadow: 0px 0px 0px 4px rgba(104,171,194,0.6);
}</pre>
<p>The container for the image panels will occupy all the width and it will be positioned absolutely. This container will be used later in order to set the background image to the currently selected image. We need to do this in order to have an image visible by default. So we&#8217;ll also add some background properties already:</p>
<pre class="brush:css">.cr-bgimg{
	width: 600px;
	height: 400px;
	position: absolute;
	left: 0px;
	top: 0px;
	z-index: 1;
	background-repeat: no-repeat;
	background-position: 0 0;
}</pre>
<p>Since we have four panels/images, one panel will have the width of 150 pixels (600 divided by 4). The panels will be floating left and we&#8217;ll hide their overflow since we don&#8217;t want to see the slices coming out when we slide them:</p>
<pre class="brush:css">.cr-bgimg div{
	width: 150px;
	height: 100%;
	position: relative;
	float: left;
	overflow: hidden;
	background-repeat: no-repeat;
}</pre>
<p>Each slice span will be positioned absolutely and initially, they will be hidden by placing them out of the panel with a left of -150px:</p>
<pre class="brush:css">.cr-bgimg div span{
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0px;
	left: -150px;
	z-index: 2;
	text-indent: -9000px;
}</pre>
<p>Now, let&#8217;s take care of the background of the image container and the respective image slices:</p>
<pre class="brush:css">.cr-container input.cr-selector-img-1:checked ~ .cr-bgimg,
.cr-bgimg div span:nth-child(1){
	background-image: url(../images/1.jpg);
}
.cr-container input.cr-selector-img-2:checked ~ .cr-bgimg,
.cr-bgimg div span:nth-child(2){
	background-image: url(../images/2.jpg);
}
.cr-container input.cr-selector-img-3:checked ~ .cr-bgimg,
.cr-bgimg div span:nth-child(3){
	background-image: url(../images/3.jpg);
}
.cr-container input.cr-selector-img-4:checked ~ .cr-bgimg,
.cr-bgimg div span:nth-child(4){
	background-image: url(../images/4.jpg);
}</pre>
<p>We also need to give the right background position to the slices depending on the panel:</p>
<pre class="brush:css">.cr-bgimg div:nth-child(1) span{
	background-position: 0px 0px;
}
.cr-bgimg div:nth-child(2) span{
	background-position: -150px 0px;
}
.cr-bgimg div:nth-child(3) span{
	background-position: -300px 0px;
}
.cr-bgimg div:nth-child(4) span{
	background-position: -450px 0px;
}</pre>
<p>When we click on a label we will simply slide all the slices out to the right:</p>
<pre class="brush:css">.cr-container input:checked ~ .cr-bgimg div span{
	animation: slideOut 0.6s ease-in-out;
}
@keyframes slideOut{
	0%{
		left: 0px;
	}
	100%{
		left: 150px;
	}
}</pre>
<p>&#8230;all except the slices with the respective background image. Those will slide in from -150px to 0px:</p>
<pre class="brush:css">.cr-container input.cr-selector-img-1:checked ~ .cr-bgimg div span:nth-child(1),
.cr-container input.cr-selector-img-2:checked ~ .cr-bgimg div span:nth-child(2),
.cr-container input.cr-selector-img-3:checked ~ .cr-bgimg div span:nth-child(3),
.cr-container input.cr-selector-img-4:checked ~ .cr-bgimg div span:nth-child(4)
{
	transition: left 0.5s ease-in-out;
	animation: none;
	left: 0px;
	z-index: 10;
}</pre>
<p>Last, but not least, we want to style the h3 title elements and their spans. The h3 will have a opacity transition and once we select the respective label/input the opacity will increase from 0 to 1:</p>
<pre class="brush:css">.cr-titles h3{
	position: absolute;
	width: 100%;
	text-align: center;
	top: 50%;
	z-index: 10000;
	opacity: 0;
	color: #fff;
	text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
	transition: opacity 0.8s ease-in-out;
}
.cr-titles h3 span:nth-child(1){
	font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif;
	font-size: 70px;
	display: block;
	letter-spacing: 7px;
}
.cr-titles h3 span:nth-child(2){
	letter-spacing: 0px;
	display: block;
	background: rgba(104,171,194,0.9);
	font-size: 14px;
	padding: 10px;
	font-style: italic;
	font-family: Cambria, Palatino, "Palatino Linotype", "Palatino LT STD", Georgia, serif;
}
.cr-container input.cr-selector-img-1:checked ~ .cr-titles h3:nth-child(1),
.cr-container input.cr-selector-img-2:checked ~ .cr-titles h3:nth-child(2),
.cr-container input.cr-selector-img-3:checked ~ .cr-titles h3:nth-child(3),
.cr-container input.cr-selector-img-4:checked ~ .cr-titles h3:nth-child(4){
	opacity: 1;
}</pre>
<p>If you don&#8217;t want to use the label trick on mobile devices you could, for example, use a media query:</p>
<pre class="brush:css">@media screen and (max-width: 768px) {
	.cr-container input{
		display: inline;
		width: 24%;
		margin-top: 350px;
		z-index: 1000;
		position: relative;
	}
	.cr-container label{
		display: none;
	}
}</pre>
<p>This is just a quick solution and it might be better to check, <a href="http://v4.thewatchmakerproject.com/blog/how-to-fix-the-broken-ipad-form-label-click-issue/">if the label trick is supported</a>.</p>
<p>And that&#8217;s it! There are many possibilities of animations that can be done here. Check out the demos to see more.</p>
<h3>Demos</h3>
<ol>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3SlidingImagePanels/index.html">Demo 1: Slide to right</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3SlidingImagePanels/index2.html">Demo 2: Odd/even slide to left/right</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3SlidingImagePanels/index3.html">Demo 3: Odd/even slide up/down</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3SlidingImagePanels/index4.html">Demo 4: Scale up/down</a></strong></li>
</ol>
<p>And that&#8217;s it! I hope you enjoyed this tutorial and find it inspiring!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3SlidingImagePanels/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3SlidingImagePanels/CSS3SlidingImagePanels.zip">Download source</a></p>
<div class="googlead"></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/01/17/sliding-image-panels-with-css3/feed/</wfw:commentRss>
		<slash:comments>69</slash:comments>
		</item>
		<item>
		<title>Experimental CSS3 Animations for Image Transitions</title>
		<link>http://tympanus.net/codrops/2011/12/19/experimental-css3-animations-for-image-transitions/</link>
		<comments>http://tympanus.net/codrops/2011/12/19/experimental-css3-animations-for-image-transitions/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 11:08:16 +0000</pubDate>
		<dc:creator>Pedro Botelho</dc:creator>
				<category><![CDATA[Playground]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[transition]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=6911</guid>
		<description><![CDATA[Today we want to share some experimental 3D image transitions with you that use CSS3 animations and jQuery. We'll be using CSS3 3D Transforms for Webkit only.]]></description>
				<content:encoded><![CDATA[<p><a href="http://tympanus.net/Development/ImageTransitions/"><img src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/uploads/2011/12/ImageTransitions.jpg" alt="ImageTransitions" width="580" height="315" class="aligncenter size-full wp-image-6918" /></a></p>
<p><a class="demo" href="http://tympanus.net/Development/ImageTransitions/">View demo</a> <a class="download" href="http://tympanus.net/Development/ImageTransitions/ImageTransitions.zip">Download source</a></p>
<p>Today we want to share some experimental 3D image transitions with you that use CSS3 animations and jQuery. We&#8217;ll be using CSS3 3D Transforms for Webkit only. Check out the <a href="http://developer.apple.com/safaridemos/showcase/transitions/">Photo Transitions</a> at the <a href="http://developer.apple.com/safaridemos/photo-transitions.php">Safari Technology Demos site</a>, some of which we got inspired by. </p>
<p>The images used in the demo are by <a href="http://www.behance.net/qstra">Joanna Kustra</a>. </p>
<p><strong><em>Please note that the 3D effects will only work in Webkit browsers. You can view a video of how the effects look here: <a href="http://www.screenr.com/DdJs">Experimental CSS3 Animations for Image Transitions Video Demonstration</a></em></strong></p>
<div class="ct-ad-article-wrapper ct-ad-article-wrapper-in"><div class="ct-ad-article"><img class="ct-ad-img" src="http://codropspz.tympanus.netdna-cdn.com/codrops/wp-content/themes/codropstheme02/images/advertisement.jpg" /><div id="bsap_1279993" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div></div></div>
<h3>How it works</h3>
<p>Given a set of images, we&#8217;ll add the first image to the wrapper with the class <strong>te-cover</strong>. With JavaScript we&#8217;ll control the transition classes given to the elements in the wrapper <strong>te-transition</strong> and which image will be shown. This is how the first example looks like:</p>
<pre class="brush:xml">
&lt;div id="te-wrapper" class="te-wrapper"&gt;
	&lt;div class="te-images"&gt;
		&lt;img src="images/1.jpg"/&gt;
		&lt;img src="images/2.jpg"/&gt;
		&lt;img src="images/3.jpg"/&gt;
		&lt;img src="images/4.jpg"/&gt;
		&lt;img src="images/5.jpg"/&gt;
	&lt;/div&gt;
	&lt;div class="te-cover"&gt;
		&lt;img src="images/1.jpg"/&gt;
	&lt;/div&gt;
	&lt;div class="te-transition"&gt;
		&lt;div class="te-card"&gt;
			&lt;div class="te-front"&gt;&lt;/div&gt;
			&lt;div class="te-back"&gt;&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>The main idea is to always show the regarding image using <strong>te-cover</strong>. When we start an animation by giving the respective animation class, the <strong>te-cover</strong> will get hidden while the animation runs. When the animation finishes, the <strong>te-cover</strong> element will be shown again, with the updated image.</p>
<h3>Demos</h3>
<p>Each demo will have a group of possible transitions that can be selected from the dropdown menu above the image.</p>
<ol>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index.html">Demo 1: Flip</a></strong></li>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index2.html">Demo 2: Rotate</a></strong></li>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index3.html">Demo 3: Multi-Flip</a></strong></li>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index4.html">Demo 4: Cube</a></strong></li>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index5.html">Demo 5: Unfold</a></strong></li>
<li><strong><a href="http://tympanus.net/Development/ImageTransitions/index6.html">Demo 6: Others</a></strong></li>
</ol>
<p><strong>We hope you like our little experiment and find it inspiring and useful! </strong></p>
<p><a class="demo" href="http://tympanus.net/Development/ImageTransitions/" >View demo</a> <a class="download" href="http://tympanus.net/Development/ImageTransitions/ImageTransitions.zip">Download source</a></p>
<div class="googlead"><!-- wp_ad_camp_1 --></div>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2011/12/19/experimental-css3-animations-for-image-transitions/feed/</wfw:commentRss>
		<slash:comments>45</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 16/25 queries in 0.011 seconds using disk: basic
Content Delivery Network via codropspz.tympanus.netdna-cdn.com

 Served from: tympanus.net @ 2013-05-25 07:03:13 by W3 Total Cache -->