<?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; Tutorials</title>
	<atom:link href="http://tympanus.net/codrops/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://tympanus.net/codrops</link>
	<description>Useful resources and inspiration for creative minds</description>
	<lastBuildDate>Wed, 23 May 2012 09:46:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Creating an Animated 3D Bouncing Ball with CSS3</title>
		<link>http://tympanus.net/codrops/2012/05/22/creating-an-animated-3d-bouncing-ball-with-css3/</link>
		<comments>http://tympanus.net/codrops/2012/05/22/creating-an-animated-3d-bouncing-ball-with-css3/#comments</comments>
		<pubDate>Tue, 22 May 2012 10:29:08 +0000</pubDate>
		<dc:creator>Daniel Sternlicht</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=9105</guid>
		<description><![CDATA[In this tutorial we'll create an animated 3D bouncing ball using only CSS3 transitions, animations and shadow effects.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/CSS3BouncingBall/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/05/bouncing-ball.jpg" alt="Creating an Animated 3D Bouncing Ball with CSS3 " title="Creating an Animated 3D Bouncing Ball with CSS3 " width="580" height="315" class="alignnone size-full wp-image-9241" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3BouncingBall/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3BouncingBall/CSS3BouncingBall.zip">Download source</a></p>
<p>Hi guys! Today we are going to see another great example of how to use <strong>the power of CSS3</strong>. We will start by creating a very cool and realistic 3D ball with pure CSS3 properties, and add a little CSS3 animations for giving the ball a &#8220;bouncing&#8221; effect.</p>
<p><strong>Please note: the result of this tutorial will only work as intended in browsers that support the respective CSS properties.</strong></p>
<h3>The HTML</h3>
<p>Let&#8217;s start with some very basic HTML:</p>
<pre class="brush:html">
&lt;div id="ballWrapper"&gt;
	&lt;div id="ball"&gt;&lt;/div&gt;
	&lt;div id="ballShadow"&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>What we have here are 3 simple DIV elements. &#8220;<strong>#ballWrapper</strong>&#8221; is the main DIV which wraps the ball. This DIV will determine the ball&#8217;s position and height on the screen. Next, we have the &#8220;<strong>#ball</strong>&#8221; element which is the ball markup, and finally there is the &#8220;<strong>#ballShadow</strong>&#8221; which holds the ball&#8217;s shadow separately from the ball itself.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The CSS</h3>
<p><em>Note that we won&#8217;t be using vendor prefixes in the tutorial. You will, of course, find them in the files.</em></p>
<p>First, we&#8217;ll want to set a basic width and height to our &#8216;#ballWrapper&#8217; DIV. It will help us position it to the center of the screen:</p>
<pre class="brush:css">
#ballWrapper {
	width: 140px;
	height: 300px;
	position: fixed;
	left: 50%;
	top: 50%;
	margin: -150px 0 0 -70px;
}
</pre>
<p>Note that I gave the DIV both top and left position properties of &#8217;50%&#8217;, and a negative top and left margin which is calculated to be exactly half of the original height and width of the DIV. That way we can center the ball on the screen.</p>
<p>Next in line, let&#8217;s give our ball some styles (grow up, it&#8217;s not that funny&#8230; :])</p>
<pre class="brush:css">
#ball {
	width: 140px;
	height: 140px;
	border-radius: 70px;
	background: linear-gradient(top,  rgba(187,187,187,1) 0%,rgba(119,119,119,1) 99%);
	box-shadow: inset 0 -5px 15px rgba(255,255,255,0.4),
				inset -2px -1px 40px rgba(0,0,0,0.4),
				0 0 1px #000;
}
</pre>
<p>We are giving the ball equal width and height and a &#8216;border-radius&#8217; property with a value of &#8217;70px&#8217; (which is half of the original width and height we&#8217;ve set) so it will be a <strong>ball</strong> and not an <strong>oval</strong> shape.</p>
<p>Another thing you&#8217;ll notice is the background. I gave the ball&#8217;s element a linear background and 3 different box shadow levels so it would get the 3D effect. The first box shadow level is for the <strong>dark shadowing</strong> at the bottom of the ball (see image). Then, we have the second level that is responsible for the blurry glow &#8211; again, at the bottom of the ball. Finally the third level is a hardly noticeable blurry shadow behind the contours of the ball.</p>
<p><img class="alignnone size-full wp-image-9165" title="boxshadow-levels" src="http://tympanus.net/codrops/wp-content/uploads/2012/05/boxshadow-levels.png" alt="" /></p>
<p>If you take a look at the ball you&#8217;ll notice that there is another small oval shape on top of the ball that gives it a reflection effect. Here is how I created it:</p>
<pre class="brush:css">
#ball::after {
	content: "";
	width: 80px;
	height: 40px;
	position: absolute;
	left: 30px;
	top: 10px;
	background: linear-gradient(top,  rgba(232,232,232,1) 0%,rgba(232,232,232,1) 1%,rgba(255,255,255,0) 100%);
	border-radius: 40px / 20px;
}
</pre>
<p>I used the CSS pseudo element <strong>::after</strong> and gave it a linear gradient with an opacity. In addition, I&#8217;ve set the border radius to &#8217;40px / 20px&#8217; so it has an oval shape.</p>
<p>Next, let&#8217;s handle the ball&#8217;s shadow:</p>
<pre class="brush:css">
 #ballShadow {
	width: 60px;
	height: 75px;
	position: absolute;
	z-index: 0;
	bottom: 0;
	left: 50%;
	margin-left: -30px;
	background: rgba(20, 20, 20, .1);
	box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
	border-radius: 30px / 40px;
}
</pre>
<p>Again, I used the same properties for centering the shadow, but this time I pinned it to the bottom of &#8216;#ballWrapper&#8217;. I also added a semi-transparent background to it, a fitting box shadow and a border radius.</p>
<h3>The bouncing animation</h3>
<p>Now let&#8217;s take a look at the fun stuff&#8230;</p>
<p>I&#8217;ll start by adding the animation property to our ball:</p>
<pre class="brush:css">
#ball {
	animation: jump 1s infinite;
}
</pre>
<p>All I did was to define the animation&#8217;s name (<strong>jump</strong>), the animation&#8217;s duration (1 second) and how many times the animation will happen &#8211; in our case we use &#8216;infinite&#8217; which means that it will run forever.</p>
<p>The animation itself:</p>
<pre class="brush:css">
@keyframes jump {
	0% {
		top: 0;
	}
	50% {
		top: 140px;
		height: 140px;
	}
	55% {
		top: 160px;
		height: 120px;
		border-radius: 70px / 60px;
	}
	65% {
		top: 120px;
		height: 140px;
		border-radius: 70px;
	}
	95% {
		top: 0;
	}
	100% {
		top: 0;
	}
}
</pre>
<p>So, basically what I&#8217;m doing here is to play with the &#8216;top&#8217; position property of the ball. Starting from 0, through 160 and back to 0. You&#8217;ll notice that in the middle of the animation I&#8217;m also playing with the &#8216;border-radius&#8217; property &#8211; that way I handle the &#8220;impact&#8221; of the ball on the ground.</p>
<p>And now the ball&#8217;s shadow; first let&#8217;s add the shadow&#8217;s relevant animation property:</p>
<pre class="brush:css">
#ballShadow {
	animation: shrink 1s infinite;
}
</pre>
<p>I used the same values that I used with the ball, only with a different keyframes animation called <strong>shrink</strong> which looks as follows:</p>
<pre class="brush:css">
@-keyframes shrink {
	0% {
		bottom: 0;
		margin-left: -30px;
		width: 60px;
		height: 75px;
		background: rgba(20, 20, 20, .1);
		box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
		border-radius: 30px / 40px;
	}
	50% {
		bottom: 30px;
		margin-left: -10px;
		width: 20px;
		height: 5px;
		background: rgba(20, 20, 20, .3);
		box-shadow: 0px 0 20px 35px rgba(20,20,20,.3);
		border-radius: 20px / 20px;
	}
	100% {
		bottom: 0;
		margin-left: -30px;
		width: 60px;
		height: 75px;
		background: rgba(20, 20, 20, .1);
		box-shadow: 0px 0 20px 35px rgba(20,20,20,.1);
		border-radius: 30px / 40px;
	}
}
</pre>
<p>In the shadow&#8217;s animation I played with different properties then in the ball&#8217;s animation. In order to give it all a realistic effect when it comes to the ball&#8217;s distance from the floor, I needed to animate the shadow width, height and opacity. While the ball is close to the floor, the shadow needs to be darker and smaller. When the ball jumps up, the shadow should be <strong>lighter</strong> and <strong>bigger</strong>.</p>
<p>Last, but not least, let&#8217;s add the &#8220;click effect&#8221; to the ball which makes it appear as if it moves away from us when we click and hold. To achieve this effect, all we have to use is the &#8216;<strong>:active</strong>&#8216; pseudo-class, add a transition and play with the CSS3 transform &#8216;scale&#8217; property like this:</p>
<pre class="brush:css">
#ballWrapper {
	transform: scale(1);
	transition: all 5s linear 0s;
}

#ballWrapper:active {
	transform: scale(0);
}
</pre>
<p>The transition from a transform value of scale(1) to scale(0) will make it look as if the element is moving away from you.</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3BouncingBall/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3BouncingBall/CSS3BouncingBall.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/05/22/creating-an-animated-3d-bouncing-ball-with-css3/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Animated 3D Bar Chart with CSS3</title>
		<link>http://tympanus.net/codrops/2012/05/21/animated-3d-bar-chart-with-css3/</link>
		<comments>http://tympanus.net/codrops/2012/05/21/animated-3d-bar-chart-with-css3/#comments</comments>
		<pubDate>Mon, 21 May 2012 09:37:38 +0000</pubDate>
		<dc:creator>Sergey Lukin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[pseudo-class]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=8894</guid>
		<description><![CDATA[A tutorial on how to create an animated 3d bar chart using CSS only. ]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/Animated3DBarChart/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/05/3dBarChart.jpg" alt="Animated 3D Bar Chart with CSS3" title="Animated 3D Bar Chart with CSS3" width="580" height="315" class="alignnone size-full wp-image-9188" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/Animated3DBarChart/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/Animated3DBarChart/Animated3DBarChart.zip">Download source</a></p>
<p>It all began with a small experiment that was inspired by a <a title="Tutorial from Nettuts+" href="http://net.tutsplus.com/tutorials/javascript-ajax/create-an-animated-3d-bar-chartgraph/">tutorial from Nettuts+</a> which shows a way how to embed a 3D bar chart into HTML pages using CSS, images and JavaScript. After reading the tutorial I challenged myself to turn this idea into pure CSS and see how far I can take it. The initial challenge was to create a classic semi-transparent 3D box with 6 sides. The final challenge was to create a complete 3D bar chart which we will create in this tutorial.</p>
<p>You can check out what I have done before <a href="http://sergeylukin.com/css-3d-bar-graph/">here</a>.</p>
<div class="ct-special-box"><strong>Please note: the result of this tutorial will only work as intended in browsers that support the respective CSS properties.</strong></div>
<p>Let&#8217;s write down some key requirements. The chart should be</p>
<ul>
<li>background-independent</li>
<li>adaptive (independent of the number of bars)</li>
<li>scalable (just like vector graphics)</li>
<li>easily customizable (colors, sizes and proportions)</li>
</ul>
<p>The planning phase is the most important part of any project. So let&#8217;s make a plan.</p>
<p>Before actually coding, I usually write down all potential challenges with solutions I can think of in a specific project and repeat this process until I get something that looks like a strategy that can be executed. Here is the list of challenges with solutions I came up with for this project:</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h4>Challenge #1 &#8211; A bar with movable inner block</h4>
<p><strong>What we know:</strong></p>
<ul>
<li>A bar should be represented as 3D box consisting of 6 sides</li>
<li>Inner block should be vertically movable in motion. There should be an option to hide the block.</li>
</ul>
<p><strong>What we&#8217;ll need:</strong></p>
<ul>
<li>1 div for back casing consisting of 3 sides (back side, bottom side, left side)</li>
<li>1 div for front casing consisting of 3 sides (front side, top side, right side)</li>
<li>1 div for inner block consisting of 3 sides exactly as Front casing but with lower z-index</li>
<li>1 div container to position all three pieces relatively and apply a solid background patch in the bottom right corner</li>
<li>1 div container with <em>overflow: hidden</em> to hide the inner block under the bar when it goes down to zero</li>
</ul>
<p><strong>That makes a total of 5 divs.</strong></p>
<p>You may wonder why would we need two containers? Well, it may be a tricky part but I will try to explain.<br />
We need at least one container per bar (to hold front casing, back casing and inner block relatively to it). We know that our bar should be scalable, so we use percentages to manipulate the bar&#8217;s fill value, which requires our container&#8217;s height to be equal to the height of one of the bar&#8217;s sides.</p>
<p>Seems fine, but wait, looks like there is another problem &#8211; there should be an option to hide the inner block in motion, which means it should go &#8220;below the bar&#8221; and be hidden there. You may say we have a solution for that &#8211; <em>overflow: hidden</em>, right? Yes, but not for that container as its height is shorter than the actual height of the bar. That is why we add another container over it and apply <em>overflow: hidden</em> to it.<br />
Hope this makes sense. Let&#8217;s move on.</p>
<h4>Challenge #2 &#8211; The Graph Holder</h4>
<p><strong>The graph holder should</strong></p>
<ul>
<li>be represented in 3D with axes and with 3 sides (background, bottom, left)</li>
<li>be background-independent</li>
<li>be adaptive to the number of bars and their attributes (height, width etc.)</li>
<li>have X and Y axis labels from outside</li>
</ul>
<p><strong>What we&#8217;ll need:</strong></p>
<ul>
<li>1 unordered list</li>
<li>1 element inside each list item for the X axis labels</li>
<li>1 bar inside each list item</li>
<li>1 list item with an unordered list inside it for the Y axis labels</li>
</ul>
<p>Hmm, unordered list? Isn&#8217;t it more semantic to use a definition list for a bar chart? Well, it is probably more semantic, but we can&#8217;t use it because we have to wrap every bar and its own X axis label in one container in order to position them relatively.</p>
<p>All right, but why wouldn&#8217;t we use a list item instead of the bar&#8217;s second container then? Well, we can&#8217;t do that because we have to place the X axis labels outside the graph and since we know that the bar&#8217;s second container hides any content that overflows it, we will use list items just to make sure all elements are positioned properly.</p>
<h3>The Implementation</h3>
<p>Now that we have a strategy, let&#8217;s convert it into code.</p>
<p><em>Please note that no vendor prefixes will be used in this tutorial. You can, of course, find them in the CSS files of the demo.</em></p>
<h4>Challenge #1 &#8211; A bar with movable inner block</h4>
<pre class="brush:html">&lt;div class="bar-wrapper"&gt;
  &lt;div class="bar-container"&gt;
    &lt;div class="bar-background"&gt;&lt;/div&gt;
    &lt;div class="bar-inner"&gt;50&lt;/div&gt;
    &lt;div class="bar-foreground"&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Let&#8217;s go over the purpose of each element once again:</p>
<ul>
<li><em>bar-wrapper</em> &#8211; hides .bar-inner when it slides down below the bar</li>
<li><em>bar-container</em> &#8211; positions .bar-foreground, .bar-inner, .bar-foreground relatively and places patch for background in a bottom corner</li>
<li><em>bar-background</em> &#8211; creates 3 sides of casing: back, bottom, left</li>
<li><em>bar-inner</em> &#8211; the most important part probably &#8211; inner block</li>
<li><em>bar-foreground</em> &#8211; creates 3 sides of casing: front, top, right</li>
</ul>
<p>First, let&#8217;s style the containers.</p>
<pre class="brush:css">
/* Bar wrapper - hides the inner bar when it goes below the bar, required */
.bar-wrapper {
  overflow: hidden;
}
/* Bar container - this guy is a real parent of a bar's parts - they all are positioned relative to him */
.bar-container {
  position: relative;
  margin-top: 2.5em; /* should be at least equal to the top offset of background casing */
                     /* because back casing is positioned higher than actual bar */
  width: 12.5em; /* required, we have to define the width of a bar */
}
/* right bottom patch - make sure inner bar's right bottom corner is "cut" when it slides down */
.bar-container:before {
  content: "";
  position: absolute;
  z-index: 3; /* to be above .bar-inner */

  bottom: 0;
  right: 0;

  /* Use bottom border to shape triangle */
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 2.5em 2.5em;
  border-color: transparent transparent rgba(183,183,183,1);
}</pre>
<p>Note that we set <em>.bar-container</em>&#8216;s width to 12.5em. This number is a sum of the bar&#8217;s front and right sides widths &#8211; in our example it&#8217;s 10 + 2.5 = 12.5</p>
<p>We also use borders to shape the triangle and place it in the bottom right corner of <em>.bar-container</em> to make sure the inner bar&#8217;s side is &#8220;cut&#8221; when it moves vertically. We use the :before pseudo class to generate this element; we will use :before and :after pseudo classes a lot in this tutorial.</p>
<p>Now let&#8217;s style the back casing:</p>
<pre class="brush:css">
/* Back panel */
.bar-background {
  width: 10em;
  height: 100%;
  position: absolute;
  top: -2.5em;
  left: 2.5em;
  z-index: 1; /* just for reference */
}

.bar-background:before,
.bar-background:after {
  content: "";
  position: absolute;
}

/* Bottom panel */
.bar-background:before {
  bottom: -2.5em;
  right: 1.25em;
  width: 10em;
  height: 2.5em;
  transform: skew(-45deg);
}

/* Left back panel */
.bar-background:after {
  top: 1.25em;
  right: 10em;
  width: 2.5em;
  height: 100%;

  /* skew only the Y-axis */
  transform: skew(0deg, -45deg);
}</pre>
<p>As you can see we move the casing 2.5em up and right. And sure enough, we skew the left and bottom sides 45 degrees. Notice that we set the first skew value to 0deg, and the second one to -45deg which allows us to skew this element vertically.</p>
<p>It&#8217;s time to style the front casing.</p>
<pre class="brush:css">
/* Front panel */
.bar-foreground {
    z-index: 3; /* be above .bar-background and .bar-inner */
}
.bar-foreground,
.bar-inner {
  position: absolute;
  width: 10em;
  height: 100%;
  top: 0;
  left: 0;
}

.bar-foreground:before,
.bar-foreground:after,
.bar-inner:before,
.bar-inner:after {
  content: "";
  position: absolute;
}

/* Right front panel */
.bar-foreground:before,
.bar-inner:before {
  top: -1.25em;
  right: -2.5em;
  width: 2.5em;
  height: 100%;
  background-color: rgba(160, 160, 160, .27);

  transform: skew(0deg, -45deg);
}

/* Top front panel */
.bar-foreground:after,
.bar-inner:after {
  top: -2.5em;
  right: -1.25em;
  width: 100%;
  height: 2.5em;
  background-color: rgba(160, 160, 160, .2);

  transform: skew(-45deg);
}</pre>
<p>Nothing new here, everything is the same as in the back casing styles, we just use different directions.<br />
The good part is that we applied those styles to both front casing and the inner block. Why not? They are exactly the same thing in terms of their shape.</p>
<p>All right, and now the styles for the inner block that we have not yet applied.</p>
<pre class="brush:css">
.bar-inner {
  z-index: 2; /* to be above .bar-background */
  top: auto; /* reset position top */
  background-color: rgba(5, 62, 123, .6);
  height: 0;
  bottom: -2.5em;
  color: transparent; /* hide text values */

  transition: height 1s linear, bottom 1s linear;
}

/* Right panel */
.bar-inner:before {
  background-color: rgba(5, 62, 123, .6);
}

/* Top panel */
.bar-inner:after {
  background-color: rgba(47, 83, 122, .7);
}</pre>
<p>Great! The bars are all set. Let&#8217;s move on to the graph holder.</p>
<h4>Challenge #2 &#8211; The Graph Holder (with axis labels)</h4>
<pre class="brush:html">&lt;ul class="graph-container"&gt;
  &lt;li&gt;
    &lt;span&gt;2011&lt;/span&gt;
    &lt;-- HTML markup of a bar goes here --&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;span&gt;2012&lt;/span&gt;
    &lt;-- HTML markup of a bar goes here --&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;ul class="graph-marker-container"&gt;
      &lt;li&gt;&lt;span&gt;25%&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;span&gt;50%&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;span&gt;75%&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;span&gt;100%&lt;/span&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;</pre>
<p>As you can see we use an unordered list and span elements inside the items to position the X- and Y- axis labels.</p>
<pre class="brush:css">
/** Graph Holder container **/
.graph-container {
  position: relative; /* required Y axis stuff, Graph Holder's left and bottom sides to be positions properly */
  display: inline-block; /* display: table may also work.. */
  padding: 0; /* let the bars position themselves */
  list-style: none; /* we don't want to see any default &lt;ul&gt; markers */

  /* Graph Holder's Background */
  background-image: linear-gradient(left , rgba(255, 255, 255, .3) 100%, transparent 100%);
  background-repeat: no-repeat;
  background-position: 0 -2.5em;
}</pre>
<p>The tricky part here is the background. We use a linear gradient to fill the graph container and lift it up by 2.5em. Why? Because our graph holder&#8217;s bottom side (which we will style next) is 2.5em high and is skewed by 45 degrees so there is an empty space in the right bottom corner. </p>
<p>Let&#8217;s style the bottom side now.</p>
<pre class="brush:css">
/* Graph Holder bottom side */
.graph-container:before {
  position: absolute;
  content: "";

  bottom: 0;
  left: -1.25em; /* skew pushes it left, so we move it a bit in opposite direction */

  width: 100%; /* make sure it is as wide as the whole graph */

  height: 2.5em;
  background-color: rgba(183, 183, 183, 1);

  /* Make it look as if in perspective */
  transform: skew(-45deg);
}</pre>
<p>We skew it by 45 degrees and move it a bit to the left just to make sure it is positioned properly. We gave it 50% width just to make sure it fills the gap before the first bar, then, every bar will continue drawing this line (we will do it shortly).</p>
<p>Now let&#8217;s style left the side of our graph holder:</p>
<pre class="brush:css">/* Graph Holder left side*/
.graph-container:after {
  position: absolute;
  content: "";

  top: 1.25em; /* skew pushes it up so we move it down a bit */
  left: 0em;

  width: 2.5em;
  background-color: rgba(28, 29, 30, .4);

  /* Make it look as if in perspective */
  transform: skew(0deg, -45deg);
}</pre>
<p>Nothing special here. Just skewed the element by 45 degrees as usual and pushed it down a bit in order to position it properly.</p>
<p>We&#8217;re done with the graph holder. Now let&#8217;s add some magic to the list items that hold our bars:</p>
<pre class="brush:css">/* Bars and X-axis labels holder */
.graph-container &gt; li {
  float: left; /* Make sure bars are aligned one next to another*/
  position: relative; /* Make sure X-axis labels are positioned relatively to this element */
}
/* A small hack to make Graph Holder's background side be wide enough
   ...because our bottom side is skewed and pushed to the right, we have to compensate it in the graph holder's background */
.graph-container &gt; li:nth-last-child(2) {
  margin-right: 2.5em;
}
/* X-axis labels */
.graph-container &gt; li &gt; span {
  position: absolute;
  left: 0;
  bottom: -2em;
  width: 80%; /* play with this one if you change perspective depth */
  text-align: center;

  font-size: 1.5em;
  color: rgba(200, 200, 200, .4);
}
</pre>
<p>A few things happened here. First of all, we float our bars next to each other. Usually, I&#8217;m trying to be very careful with using floats, but in this case it fits perfectly in my opinion.</p>
<p>Secondly, we add some right margin to the last bar. That way we make sure we give enough space to the graph holder&#8217;s bottom side to show up in the right bottom corner. Try to remove it and you will see what I mean.</p>
<p>OK, we&#8217;re almost there. The last thing left is to add Y-axis markers..</p>
<pre class="brush:css">
/* Markers container */
.graph-container &gt; li:last-child {
  width: 100%;
  position: absolute;
  left: 0;
  bottom: 0;
}

/* Y-axis Markers list */
.graph-marker-container &gt; li {
  position: absolute;
  left: -2.5em;
  bottom: 0;
  width: 100%;
  margin-bottom: 2.5em;
  list-style: none;
}

/* Y-axis lines general styles */
.graph-marker-container &gt; li:before,
.graph-marker-container &gt; li:after {
  content: "";
  position: absolute;
  border-style: none none dotted;
  border-color: rgba(100, 100, 100, .15);
  border-width: 0 0 .15em;
  background: rgba(133, 133, 133, .15);
}

/* Y-axis Side line */
.graph-marker-container &gt; li:before {
  width: 3.55em;
  height: 0;
  bottom: -1.22em;
  left: -.55em;
  z-index: 2; /* be above .graph-container:after */
  transform: rotate(-45deg);
}

/* Y-axis Background line */
.graph-marker-container li:after {
  width: 100%;
  bottom: 0;
  left: 2.5em;
}

/* Y-axis text Label */
.graph-marker-container span {
  color: rgba(200, 200, 200, .4);
  position: absolute;

  top: 1em;
  left: -3.5em; /* just to push it away from the graph.. */
  width: 3.5em; /* give it absolute value of left offset */

  font-size: 1.5em;
}</pre>
<p>As you can see, we set 100% width to our markers holder in order to be able to draw throughout the whole graph, use a dotted border to style our Y-axis lines and position the span element so that the Y-axis label is outside of the graph. With the help of :before and :after we could keep our HTML pretty clean.</p>
<p>Well, we finished setting up all the styles for our graph, however we didn&#8217;t set some vital variables &#8211; sizes, colors and bars fill values! We said that our graph will be customizable, right? So, I decided not to mix variables with the rest of the code so that you can play with them..</p>
<pre class="brush:css">
/****************
 * SIZES        *
 ****************/
 /* Size of the Graph */
.graph-container,
.bar-container {
  font-size: 8px;
}
/* Height of Bars */
.bar-container,
.graph-container:after,
.graph-container &gt; li:last-child {
  height: 40em;
}

/****************
 * SPACING      *
 ****************/
/* spacing between bars */
.graph-container &gt; li .bar-container {
  margin-right: 1.5em;
}
/* spacing before first bar */
.graph-container &gt; li:first-child {
  margin-left: 1.5em;
}
/* spacing after last bar */
.graph-container &gt; li:nth-last-child(2) .bar-container {
  margin-right: 1.5em;
}

/****************
 *    Colors    *
 ****************/
/* Bar's Back side */
.bar-background {
  background-color: rgba(160, 160, 160, .1);
}
/* Bar's Bottom side */
.bar-background:before {
  background-color: rgba(160, 160, 160, .2);
}
/* Bar's Left Back side */
.bar-background:after {
  background-color: rgba(160, 160, 160, .05);
}
/* Bar's Front side */
.bar-foreground {
  background-color: rgba(160, 160, 160, .1);
}
/* Bar's inner block */
.bar-inner,
.bar-inner:before { background-color: rgba(5, 62, 123, .6); }
.bar-inner:after { background-color: rgba(47, 83, 122, .7); }

/*************************************
 *   Bars Fill                       *
 * Just an example of filling 3 bars *
 *************************************/
.graph-container &gt; li:nth-child(1) .bar-inner { height: 25%; bottom: 0; }
.graph-container &gt; li:nth-child(2) .bar-inner { height: 50%; bottom: 0; }
.graph-container &gt; li:nth-child(3) .bar-inner { height: 75%; bottom: 0; }</pre>
<p>In the demo provided with this tutorial you will not find this part as it is here, because I did something even more interesting there &#8211; I used radio buttons to let you play with the variables without modifying the code. Feel free to check out its source code. But if you just need to customize a static graph grab the code snippet from above and customize it to your preference.</p>
<h3>Conclusion</h3>
<p>Let&#8217;s go over some featured CSS specifications/techniques we covered in this tutorial. So, we&#8217;ve used</p>
<ul>
<li><strong>transform: skew()</strong> and <strong>transform: rotate()</strong> in order to transform our elements so that together they generate an illusion of a 3D object</li>
<li><strong>:before</strong> and<strong> :after</strong> pseudo classes to generate elements with CSS and keep our HTML markup relatively clean</li>
<li><strong>:nth-last-child()</strong> and <strong>:not</strong> pseudo classes to target specific list items and avoid adding extra classes/ids to the markup</li>
<li><strong>linear-gradient</strong> together with background-position to <em>partially</em> fill an element with a background</li>
<li><strong>rgba()</strong> for colors with alpha-transparency</li>
<li><strong>borders</strong> to create shapes like a triangle</li>
</ul>
<p>I really hope that this tutorial was useful to you. If you have any questions regarding this tutorial, let me know in the comments below.</p>
<div class="ct-github-link">
<a href="https://github.com/sergeylukin/css-3d-bar-graph">Find this project on Github</a>
</div>
<p><a class="demo" href="http://tympanus.net/Tutorials/Animated3DBarChart/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/Animated3DBarChart/Animated3DBarChart.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/05/21/animated-3d-bar-chart-with-css3/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Annotation Overlay Effect with CSS3</title>
		<link>http://tympanus.net/codrops/2012/05/14/annotation-overlay-effect-with-css3/</link>
		<comments>http://tympanus.net/codrops/2012/05/14/annotation-overlay-effect-with-css3/#comments</comments>
		<pubDate>Mon, 14 May 2012 13:05:10 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[overlay]]></category>
		<category><![CDATA[pseudo-class]]></category>
		<category><![CDATA[sibling combinator]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=9029</guid>
		<description><![CDATA[A tutorial about how to create an overlay effect to show some more details of an item or image. The effect is CSS-only and uses a combination of the :checked pseudo-class with the sibling combinator.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/CSS3AnnotationOverlayEffect/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/05/AnnotationOverlayEffectwithCSS3.jpg" alt="Annotation Overlay Effect with CSS3" title="Annotation Overlay Effect with CSS3" width="580" height="315" class="alignnone size-full wp-image-9038" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3AnnotationOverlayEffect/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3AnnotationOverlayEffect/CSS3AnnotationOverlayEffect.zip">Download source</a></p>
<p>In this tutorial we&#8217;ll create a little overlay effect with CSS using a combination of the <strong>:checked pseudo-class</strong> with <strong>sibling combinators</strong>. The idea is to make an image or element clickable and transition to an overlay-like state that will show us some annotation boxes. </p>
<p>The theme preview images used in this tutorial are by talented <a href="http://www.anariel.com/">Ana Segota</a> and you can <a href="http://themeforest.net/user/anariel7">purchase her themes and templates here</a>. </p>
<p>The beautiful arrow icons are by <a href="http://www.alessioatzeni.com/">Alessio Atzeni</a> and you can find them <a href="http://www.alessioatzeni.com/blog/simple-arrows-psd/">here</a>.</p>
<div class="ct-special-box"><strong>Please note: the result of this tutorial will only work as intended in browsers that support the respective CSS properties.</strong></div>
<h3>The Markup</h3>
<p>Our structure will consist of a part for some title and description, and a preview part. The preview part will have the overlay effect. The idea is to add a checkbox, an image and a division for the annotations, containing spans. The trick is to actually put the checkbox <em>on top of</em> the other elements, so that it remains clickable. It needs to stay first in the structure though because we want to be able &#8220;to reach&#8221; its siblings, the image and the annotations division: </p>
<pre class="brush:xml">
&lt;div class="ao-item"&gt;
	&lt;div class="ao-details"&gt;
		&lt;h2&gt;Some title&lt;/h2&gt;
		&lt;p&gt;Some description&lt;/p&gt;
	&lt;/div&gt;
	&lt;div class="ao-preview"&gt;
		&lt;input type="checkbox" id="ao-toggle" class="ao-toggle" name="ao-toggle" /&gt;
		&lt;img src="images/image01.jpg" alt="image01" /&gt;
		&lt;div class="ao-annotations"&gt;
			&lt;span&gt;Full Localisation Support&lt;/span&gt;
			&lt;span&gt;Custom Image Widget&lt;/span&gt;
			&lt;span&gt;Blog and Contact Widgets&lt;/span&gt;
			&lt;span&gt;Easy Theme Options&lt;/span&gt;
			&lt;span&gt;4 Footer Widget Columns&lt;/span&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>There can be any number of spans. We will position each one individually.<br />
Let&#8217;s take a look at the CSS.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The CSS</h3>
<p><em>Note that we will exclude vendor prefixes. You will of course find them in the files.</em><br />
The division with the class <strong>ao-item</strong> will have a width of 80% because we want the whole thing to be fluid:</p>
<pre class="brush:css">
.ao-item {
	width: 80%;
	margin: 0 auto;
	padding: 35px 0;
	position: relative;
	clear: both;
}
</pre>
<p>The two inner divisions will be floating, so let&#8217;s clear some floats with this <a href="http://css-tricks.com/pseudo-element-roundup/">great technique</a>:</p>
<pre class="brush:css">
.ao-item:before,
.ao-item:after {
    content:"";
    display:table;
}

.ao-item:after {
    clear:both;
}

.ao-item {
    zoom:1; /* For IE 6/7 (trigger hasLayout) */
} /* from CSSTricks: http://css-tricks.com/pseudo-element-roundup/ */
</pre>
<p>Let&#8217;s style the details part with the title and the description. We&#8217;ll make it float right and give it a width of 40%. We&#8217;ll also add a left padding which will not cause us any trouble because we&#8217;ve applied <strong>box-sizing: border-box</strong> to all our elements in the <strong>normalize.css</strong> file. So this will ensure that the division is really 40% wide and the padding is &#8220;inside&#8221; of that and not added to it:</p>
<pre class="brush:css">
.ao-details {
	float: right;
	width: 40%;
	padding-left: 20px;
}
</pre>
<p>Then we&#8217;ll add some styling to the text elements:</p>
<pre class="brush:css">
.ao-details h2 {
	color: #498EA5;
	margin-top: 0;
	text-shadow: 1px 1px 1px rgba(255,255,255,0.5);
	padding-bottom: 10px;
	box-shadow:
		0 1px 0 #DFDEDC,
		0 2px 0 rgba(255,255,255,0.5);
}

.ao-details p {
	color: #999;
	text-shadow: 1px 1px 1px rgba(255,255,255,0.8);
	line-height: 22px;
}

.ao-details p a{
	font-weight: bold;
	color: #498EA5;
}

.ao-details p a:hover{
	color: #2A3344;
}
</pre>
<p>The preview division will be a bit bigger and floating left:</p>
<pre class="brush:css">
.ao-preview {
	width: 60%;
	float: left;
	position: relative;
}
</pre>
<p>Now we&#8217;ll style the image. In order to make it responsive, we&#8217;ll give it a max-width of 100%. This will ensure that it will be contained in the parent division. The image will have a transition. The idea is to scale it down a bit, once we click on the associated checkbox:</p>
<pre class="brush:css">
.ao-item img {
	margin: 0 auto;
	max-width: 100%;
	display: block;
	opacity: 0.8;
	box-shadow: 1px 1px 10px rgba(0,0,0,0.2);
	transition: all 0.3s ease-in-out;
}
</pre>
<p>The annotations division is our overlay and we&#8217;ll place it absolutely. We&#8217;ll make it invisible by setting the opacity to 0. It will also have a transition: we want it to scale it up and make it become opaque once we click on the checkbox.</p>
<pre class="brush:css">
.ao-annotations {
	width: 100%;
	height: 100%;
	position: absolute;
	top: 0px;
	left: 0px;
	background: rgba(33,62,68,0.3);
	box-shadow: 1px 1px 3px rgba(0,0,0,0.05);
	opacity: 0;
	z-index: 5;
	transform: scale(0.8);
	transition: all 0.3s ease-in-out;
}
</pre>
<p>The annotation spans will be of absolute position (we&#8217;ll set each of the tops and lefts) and we&#8217;ll give them a min-width of 140 pixel since the width is in percentage. The transition effect will be to scale down and appear (opacity: 1):</p>
<pre class="brush:css">
.ao-annotations span {
	display: block;
	position: absolute;
	padding: 10px 25px;
	width: 33%;
	min-width: 140px;
	text-align: center;
	background: rgba(255,255,255,1);
	color: rgba(20,40,47,0.9);
	font-size: 16px;
	font-style: italic;
	text-shadow: 1px 1px 1px rgba(255,255,255,0.9);
	box-shadow: 0px 1px 4px rgba(0,0,0,0.2);
	opacity: 0;
	transform: scale(1.3);
	transition: all 0.3s ease-in-out;
}
</pre>
<p>Each annotation span is going to have a little arrow and we&#8217;ll add it using the pseudo-class :after. </p>
<pre class="brush:css">
.ao-annotations span:after {
	position: absolute;
	background: transparent url(../images/arrow.png) no-repeat center center;
	width: 32px;
	height: 33px;
	top: 50%;
	left: 100%;
	margin: -16px 0 0 -16px;
	content: '';
}
</pre>
<p>Two of our spans will have the arrow on the left side: </p>
<pre class="brush:css">
.ao-annotations span:nth-child(3):after,
.ao-annotations span:nth-child(4):after {
	left: auto;
	right: 100%;
	margin: -16px -16px 0 0;
	background-image: url(../images/arrow_left.png);
}
</pre>
<p>Now we&#8217;ll set the positions for each one of the spans. We&#8217;ll use percentages again so that the positioning still makes sense, when we resize things:</p>
<pre class="brush:css">
.ao-annotations span:nth-child(1) {
	top: 5%;
	left: 5%;
}

.ao-annotations span:nth-child(2) {
	top: 20%;
	left: -13%;
}

.ao-annotations span:nth-child(3) {
	top: 37%;
	right: 2%;
}

.ao-annotations span:nth-child(4) {
	top: 53%;
	right: -8%;
}

.ao-annotations span:nth-child(5) {
	bottom: 18%;
	left: -4%;
}
</pre>
<p>Let&#8217;s take care of that checkbox now. The trick is to put it on top of all the other elements and set its height and width to 100% meaning that it will occupy all the division, so that we can click anywhere to trigger the effect. It will be &#8220;hidden&#8221; since we set the opacity to 0. But it&#8217;s still there, so we can click on it. The z-index needs to be higher than the one of the other elements, so, just to make sure, we&#8217;ll set it very high:</p>
<pre class="brush:css">
input.ao-toggle {
	width: 100%;
	height: 100%;
	position: absolute;
	top: 0px;
	left: 0px;
	margin: 0;
	padding: 0;
	opacity: 0;
	z-index: 100;
	border: none;
	cursor: pointer;
}
</pre>
<p>And now we will define what happens to the siblings when we click on the checkbox. The image will scale down, change its box-shadow and become opaque:</p>
<pre class="brush:css">
input.ao-toggle:checked + img {
	box-shadow: 1px 1px 6px rgba(0,0,0,0.2);
	opacity: 1;
	transform: scale(0.8);
}
</pre>
<p>Since we can&#8217;t use img:hover anymore (remember, the checkbox is on top of everything else), we&#8217;ll use the hover on the checkbox input to trigger the hover effect of the image:</p>
<pre class="brush:css">
input.ao-toggle:hover + img{
	opacity: 1;
}
</pre>
<p>The overlay with the class <strong>ao-annoations</strong> and its spans will scale to 1 and become opaque:</p>
<pre class="brush:css">
input.ao-toggle:checked ~ .ao-annotations,
input.ao-toggle:checked ~ .ao-annotations span{
	opacity: 1;
	transform: scale(1);
}
</pre>
<p>To add a little cherry on top, we&#8217;ll make each span appear with a delay:</p>
<pre class="brush:css">
input.ao-toggle:checked ~ .ao-annotations span:nth-child(1) {
	transition-delay: 0.3s;
}

input.ao-toggle:checked ~ .ao-annotations span:nth-child(2) {
	transition-delay: 0.4s;
}

input.ao-toggle:checked ~ .ao-annotations span:nth-child(3) {
	transition-delay: 0.5s;
}

input.ao-toggle:checked ~ .ao-annotations span:nth-child(4) {
	transition-delay: 0.6s;
}

input.ao-toggle:checked ~ .ao-annotations span:nth-child(5) {
	transition-delay: 0.7s;
}
</pre>
<p>Last, but not least, we&#8217;ll add a media query to remove the float for the main divisions and decrease the font size for the annotation spans:</p>
<pre class="brush:css">

@media screen and (max-width: 730px){
	.ao-item .ao-details,
	.ao-preview {
		float: none;
		width: 100%;
		padding: 0;
		text-align: left;
	}
	.ao-annotations span {
		font-size: 11px;
	}
}
</pre>
<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/CSS3AnnotationOverlayEffect/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3AnnotationOverlayEffect/CSS3AnnotationOverlayEffect.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/05/14/annotation-overlay-effect-with-css3/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Fluid CSS3 Slideshow with Parallax Effect</title>
		<link>http://tympanus.net/codrops/2012/04/30/fluid-css3-slideshow-with-parallax-effect/</link>
		<comments>http://tympanus.net/codrops/2012/04/30/fluid-css3-slideshow-with-parallax-effect/#comments</comments>
		<pubDate>Mon, 30 Apr 2012 11:09:46 +0000</pubDate>
		<dc:creator>Ring Wing</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[fluid]]></category>
		<category><![CDATA[parallax]]></category>
		<category><![CDATA[sibling combinator]]></category>
		<category><![CDATA[slideshow]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=8631</guid>
		<description><![CDATA[In this tutorial we will create a slideshow with a parallax effect using several CSS3 properties. The idea is to move the background positions of two backgrounds while sliding the container of the slides.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/CSS3FluidParallaxSlideshow/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/04/CSS3FluidParallaxSlideshow.jpg" alt="Fluid CSS3 Slideshow with Parallax Effect" title="Fluid CSS3 Slideshow with Parallax Effect" width="580" height="315" class="alignnone size-full wp-image-8696" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3FluidParallaxSlideshow/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3FluidParallaxSlideshow/CSS3FluidParallaxSlideshow.zip">Download source</a></p>
<p>In this tutorial, we are going to create a slideshow with a parallax effect with the help of some CSS3 properties. We&#8217;ll use radio buttons and sibling combinators for controlling which slide is shown. There will be two backgrounds and the idea is to change the background positions and the position of the slider with transitions in order to create a slight parallax effect.</p>
<p>The graphics used in the demo are by: <a href="http://5milli.deviantart.com/art/Global-Map-Vector-100880703">5Milli</a> (Global Vector Map) and by <a href="http://wegraphics.net/downloads/free-vector-infographic-kit/">WeGraphics</a> (Free Vector Infographic Kit).</p>
<div class="ct-special-box"><strong>Please note: the result of this tutorial will only work as intended in browsers that support the respective CSS properties.</strong></div>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>We will &#8220;connect&#8221; the input elements to the division with the class <strong>sp-content</strong> by using the general sibling combinator. For that we will leave the inputs on the same level like the <strong>sp-content</strong> div. When we click on an input we will change the background color and background position of it (grid pattern) and also the background-position of the <strong>sp-parallax-bg</strong> div (the world map) with transitions. The respective slide will be shown by moving the <strong>sp-slider</strong> ul to the right position. The markup looks as follows:</p>
<pre class="brush:xml">
&lt;div class="sp-slideshow"&gt;

	&lt;input id="button-1" type="radio" name="radio-set" class="sp-selector-1" checked="checked" /&gt;
	&lt;label for="button-1" class="button-label-1"&gt;&lt;/label&gt;

	&lt;input id="button-2" type="radio" name="radio-set" class="sp-selector-2" /&gt;
	&lt;label for="button-2" class="button-label-2"&gt;&lt;/label&gt;

	&lt;input id="button-3" type="radio" name="radio-set" class="sp-selector-3" /&gt;
	&lt;label for="button-3" class="button-label-3"&gt;&lt;/label&gt;

	&lt;input id="button-4" type="radio" name="radio-set" class="sp-selector-4" /&gt;
	&lt;label for="button-4" class="button-label-4"&gt;&lt;/label&gt;

	&lt;input id="button-5" type="radio" name="radio-set" class="sp-selector-5" /&gt;
	&lt;label for="button-5" class="button-label-5"&gt;&lt;/label&gt;

	&lt;label for="button-1" class="sp-arrow sp-a1"&gt;&lt;/label&gt;
	&lt;label for="button-2" class="sp-arrow sp-a2"&gt;&lt;/label&gt;
	&lt;label for="button-3" class="sp-arrow sp-a3"&gt;&lt;/label&gt;
	&lt;label for="button-4" class="sp-arrow sp-a4"&gt;&lt;/label&gt;
	&lt;label for="button-5" class="sp-arrow sp-a5"&gt;&lt;/label&gt;

	&lt;div class="sp-content"&gt;
		&lt;div class="sp-parallax-bg"&gt;&lt;/div&gt;
		&lt;ul class="sp-slider clearfix"&gt;
			&lt;li&gt;&lt;img src="images/image1.png" alt="image01" /&gt;&lt;/li&gt;
			&lt;li&gt;&lt;img src="images/image2.png" alt="image02" /&gt;&lt;/li&gt;
			&lt;li&gt;&lt;img src="images/image3.png" alt="image03" /&gt;&lt;/li&gt;
			&lt;li&gt;&lt;img src="images/image4.png" alt="image04" /&gt;&lt;/li&gt;
			&lt;li&gt;&lt;img src="images/image5.png" alt="image05" /&gt;&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/div&gt;&lt;!-- sp-content --&gt;

&lt;/div&gt;&lt;!-- sp-slideshow --&gt;
</pre>
<p>The list elements are the wrappers for each slide and although we are using simply images here, you can use any kind of content.</p>
<h3>The CSS</h3>
<p>We&#8217;ll set the width of the main container to 80% and set the width of the divisions with class <strong>sp-content</strong> and class <strong>sp-parallax-bg</strong> to 100%. The <strong>sp-content</strong> div will have a background color and a background image (grid) that we will move whenever we slide the slider ul. The <strong>sp-parallax-bg</strong> div will have a map as background image and we will also move the background position.</p>
<pre class="brush:css">
.sp-slideshow {
    position: relative;
	margin: 10px auto;
	width: 80%;
	max-width: 1000px;
	min-width: 260px;
	height: 460px;
	border: 10px solid #fff;
	border: 10px solid rgba(255,255,255,0.9);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.sp-content {
    background: #7d7f72 url(../images/grid.png) repeat scroll 0 0;
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.sp-parallax-bg {
    background: url(../images/map.png) repeat-x scroll 0 0;
    background-size: cover;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
}
</pre>
<p>The styles of the inputs and the labels:</p>
<pre class="brush:css">
.sp-slideshow input {
    position: absolute;
	bottom: 15px;
	left: 50%;
	width: 9px;
	height: 9px;
	z-index: 1001;
	cursor: pointer;
    opacity: 0;
}

.sp-slideshow input + label {
    position: absolute;
    bottom: 15px;
	left: 50%;
    width: 6px;
	height: 6px;
	display: block;
	z-index: 1000;
	border: 3px solid #fff;
	border: 3px solid rgba(255,255,255,0.9);
    border-radius: 50%;
    transition: background-color linear 0.1s;
}
.sp-slideshow input:checked + label {
	background-color: #fff;
    background-color: rgba(255,255,255,0.9);
}

.sp-selector-1, .button-label-1 {
    margin-left: -36px;
}

.sp-selector-2, .button-label-2 {
    margin-left: -18px;
}

.sp-selector-4, .button-label-4 {
    margin-left: 18px;
}

.sp-selector-5, .button-label-5 {
    margin-left: 36px;
}
</pre>
<p>We&#8217;ve set the opacity of the inputs to 0 so that they are not visible. The labels are under the radio button and we will make it look like a little circle. All the inputs and labels will be positioned absolutely and we will place them next to each other by applying a left margin.</p>
<p>Next, we will style the arrows which are simply labels with the respective <em>for</em> attribute. Note, that clicking on a label to active an associated input might not work in mobile browsers. But anyway, you can navigate using the dots since we are actually clicking on the inputs.</p>
<p>The arrow labels have the following style:</p>
<pre class="brush:css">
.sp-arrow {
    position: absolute;
	top: 50%;
	width: 28px;
	height: 38px;
	margin-top: -19px;
	display: none;
	opacity: 0.8;
	cursor: pointer;
	z-index: 1000;
	background: transparent url(../images/arrows.png) no-repeat;
    transition: opacity linear 0.3s;
}
.sp-arrow:hover{
	opacity: 1;
}
.sp-arrow:active{
	margin-top: -18px;
}
</pre>
<p>Now, let&#8217;s define when each arrow is shown. On the first slide we, for example, don&#8217;t want to show the left arrow. And on the last slide we don&#8217;t want to show the right arrow:</p>
<pre class="brush:css">
.sp-selector-1:checked ~ .sp-arrow.sp-a2,
.sp-selector-2:checked ~ .sp-arrow.sp-a3,
.sp-selector-3:checked ~ .sp-arrow.sp-a4,
.sp-selector-4:checked ~ .sp-arrow.sp-a5 {
    right: 15px;
	display: block;
	background-position: top right;
}
.sp-selector-2:checked ~ .sp-arrow.sp-a1,
.sp-selector-3:checked ~ .sp-arrow.sp-a2,
.sp-selector-4:checked ~ .sp-arrow.sp-a3,
.sp-selector-5:checked ~ .sp-arrow.sp-a4 {
    left: 15px;
	display: block;
	background-position: top left;
}
</pre>
<p>When an input is selected, the <strong>sp-content</strong> div will have a transition for the <em>background-position</em> and the <em>background-color</em>. The second transition is going to take a bit longer:</p>
<pre class="brush:css">
.sp-slideshow input:checked ~ .sp-content {
    transition: background-position linear 0.6s, background-color linear 0.8s;
}
</pre>
<p>The div with the world map (sp-parallax-bg) will also have a transition for the background-position:</p>
<pre class="brush:css">
.sp-slideshow input:checked ~ .sp-content .sp-parallax-bg {
    transition: background-position linear 0.7s;
}
</pre>
<p>In this way we can add a background parallax effect.</p>
<p>Let&#8217;s define the changes to color and background-position for the sp-content div:</p>
<pre class="brush:css">
input.sp-selector-1:checked ~ .sp-content {
    background-position: 0 0;
	background-color: #727b7f;
}

input.sp-selector-2:checked ~ .sp-content {
    background-position: -100px 0;
	background-color: #7f7276;
}

input.sp-selector-3:checked ~ .sp-content {
    background-position: -200px 0;
	background-color: #737f72;
}

input.sp-selector-4:checked ~ .sp-content {
    background-position: -300px 0;
	background-color: #79727f;
}

input.sp-selector-5:checked ~ .sp-content {
    background-position: -400px 0;
	background-color: #7d7f72;
}
</pre>
<p>&#8230; and the sp-parallax-bg div:</p>
<pre class="brush:css">
input.sp-selector-1:checked ~ .sp-content .sp-parallax-bg {
    background-position: 0 0;
}

input.sp-selector-2:checked ~ .sp-content .sp-parallax-bg {
    background-position: -200px 0;
}

input.sp-selector-3:checked ~ .sp-content .sp-parallax-bg {
    background-position: -400px 0;
}

input.sp-selector-4:checked ~ .sp-content .sp-parallax-bg {
    background-position: -600px 0;
}

input.sp-selector-5:checked ~ .sp-content .sp-parallax-bg {
    background-position: -800px 0;
}
</pre>
<p>The unordered list with the class <strong>sp-slider</strong> will have a width of 500%. This is because we have 5 slides. It will have a transition for the left value, that we will change depening on the input that is checked:</p>
<pre class="brush:css">
.sp-slider {
    position: relative;
	left: 0;
    width: 500%;
	height: 100%;
	list-style: none;
    margin: 0;
	padding: 0;
    transition: left ease-in 0.8s;
}
</pre>
<p>Each list element is a slide and it will also have a transition for the opacity. We will give both, the slide and the image inside the box-sizing property of &#8220;border-box&#8221;. This will allow us to set a padding but also use 100% values for heights and widths and not worry about any overflow: </p>
<pre class="brush:css">
.sp-slider > li {
	color: #fff;
	width: 20%;
	box-sizing: border-box;
	height: 100%;
	padding: 0 60px;
    float: left;
	text-align: center;
	opacity: 0.4;
    transition: opacity ease-in 0.4s 0.8s;
}
.sp-slider > li img{
	box-sizing: border-box;
	display: block;
	margin: 0 auto;
	padding: 40px 0 50px 0;
	max-height: 100%;
	max-width: 100%;
}
</pre>
<p>Now we need to set the correct left values for each selected slide:</p>
<pre class="brush:css">
input.sp-selector-1:checked ~ .sp-content .sp-slider {
    left: 0;
}

input.sp-selector-2:checked ~ .sp-content .sp-slider {
    left: -100%;
}

input.sp-selector-3:checked ~ .sp-content .sp-slider {
    left: -200%;
}

input.sp-selector-4:checked ~ .sp-content .sp-slider {
    left: -300%;
}

input.sp-selector-5:checked ~ .sp-content .sp-slider {
    left: -400%;
}
</pre>
<p>Each current slide will then get opacity 1:</p>
<pre class="brush:css">
input.sp-selector-1:checked ~ .sp-content .sp-slider > li:first-child,
input.sp-selector-2:checked ~ .sp-content .sp-slider > li:nth-child(2),
input.sp-selector-3:checked ~ .sp-content .sp-slider > li:nth-child(3),
input.sp-selector-4:checked ~ .sp-content .sp-slider > li:nth-child(4),
input.sp-selector-5:checked ~ .sp-content .sp-slider > li:nth-child(5){
	opacity: 1;
}
</pre>
<p>That&#8217;s all, hope you like it!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3FluidParallaxSlideshow/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3FluidParallaxSlideshow/CSS3FluidParallaxSlideshow.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/04/30/fluid-css3-slideshow-with-parallax-effect/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Rotating Words with CSS Animations</title>
		<link>http://tympanus.net/codrops/2012/04/17/rotating-words-with-css-animations/</link>
		<comments>http://tympanus.net/codrops/2012/04/17/rotating-words-with-css-animations/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 11:21:56 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[animations]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[typography]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=8465</guid>
		<description><![CDATA[Using CSS Animations we will change or rotate some parts of a sentence.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/CSS3RotatingWords/"><br />
<img src="http://tympanus.net/codrops/wp-content/uploads/2012/04/Rotating-Words-with-CSS-Animations.jpg" alt="Rotating Words with CSS Animations" title="Rotating Words with CSS Animations" width="580" height="315" class="alignnone size-full wp-image-8467" /><br />
</a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3RotatingWords/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3RotatingWords/CSS3RotatingWords.zip">Download source</a></p>
<p>In today&#8217;s tutorial we&#8217;ll create another typography effect. The idea is to have some kind of sentence and to rotate a part of it. We&#8217;ll be &#8220;exchanging&#8221; certain words of that sentence using CSS animations. </p>
<p><strong>Please note: the result of this tutorial will only work as intended in browsers that support CSS animations.</strong></p>
<p>So let&#8217;s start!</p>
<p><em>In the following, we&#8217;ll be going through demo 2.</em></p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>We&#8217;ll have a main wrapper with a h2 heading that contains first-level spans and two divisions for the rotating words:</p>
<pre class="brush:xml">
&lt;section class="rw-wrapper"&gt;
	&lt;h2 class="rw-sentence"&gt;
		&lt;span&gt;Real poetry is like&lt;/span&gt;
		&lt;span&gt;creating&lt;/span&gt;
		&lt;div class="rw-words rw-words-1"&gt;
			&lt;span&gt;breathtaking moments&lt;/span&gt;
			&lt;span&gt;lovely sounds&lt;/span&gt;
			&lt;span&gt;incredible magic&lt;/span&gt;
			&lt;span&gt;unseen experiences&lt;/span&gt;
			&lt;span&gt;happy feelings&lt;/span&gt;
			&lt;span&gt;beautiful butterflies&lt;/span&gt;
		&lt;/div&gt;
		&lt;br /&gt;
		&lt;span&gt;with a silent touch of&lt;/span&gt;
		&lt;div class="rw-words rw-words-2"&gt;
			&lt;span&gt;sugar&lt;/span&gt;
			&lt;span&gt;spice&lt;/span&gt;
			&lt;span&gt;colors&lt;/span&gt;
			&lt;span&gt;happiness&lt;/span&gt;
			&lt;span&gt;wonder&lt;/span&gt;
			&lt;span&gt;happiness&lt;/span&gt;
		&lt;/div&gt;
	&lt;/h2&gt;
&lt;/section&gt;
</pre>
<p>Now, ignoring the garbage placeholder text, we want each span of the <strong>rw-word</strong> to appear at a time. For that we&#8217;ll be using CSS animations. We&#8217;ll create one animation for each division and each span will run it, just with different delays.<br />
So, let&#8217;s look at the CSS.</p>
<h3>The CSS3</h3>
<p>First, we will style the main wrapper and center it on the page:</p>
<pre class="brush:css">
.rw-wrapper{
	width: 80%;
	position: relative;
	margin: 110px auto 0 auto;
	font-family: 'Bree Serif';
	padding: 10px;
}
</pre>
<p>We&#8217;ll add some text shadow to all the elements in the heading:</p>
<pre class="brush:css">
.rw-sentence{
	margin: 0;
	text-align: left;
	text-shadow: 1px 1px 1px rgba(255,255,255,0.8);
}
</pre>
<p>And add some specific text styling to the spans:</p>
<pre class="brush:css">
.rw-sentence span{
	color: #444;
	white-space: nowrap;
	font-size: 200%;
	font-weight: normal;
}
</pre>
<p>The divisions will be displayed as inline elements, that will allow us to &#8220;insert&#8221; them into the sentence without breaking the flow:</p>
<pre class="brush:css">
.rw-words{
	display: inline;
	text-indent: 10px;
}
</pre>
<p>Each span inside of a <strong>rw-words</strong> div will be positioned absolutely and we&#8217;ll hide any overflow:</p>
<pre class="brush:css">
.rw-words span{
	position: absolute;
	opacity: 0;
	overflow: hidden;
	width: 100%;
	color: #6b969d;
}
</pre>
<p>Now, we&#8217;ll run two animations. As mentioned previously, we&#8217;ll run the same animation for all the spans in one div, just with different delays:</p>
<pre class="brush:css">
.rw-words-1 span{
	animation: rotateWordsFirst 18s linear infinite 0s;
}
.rw-words-2 span{
	animation: rotateWordsSecond 18s linear infinite 0s;
}
.rw-words span:nth-child(2) {
	animation-delay: 3s;
	color: #6b889d;
}
.rw-words span:nth-child(3) {
	animation-delay: 6s;
	color: #6b739d;
}
.rw-words span:nth-child(4) {
	animation-delay: 9s;
	color: #7a6b9d;
}
.rw-words span:nth-child(5) {
	animation-delay: 12s;
	color: #8d6b9d;
}
.rw-words span:nth-child(6) {
	animation-delay: 15s;
	color: #9b6b9d;
}
</pre>
<p>Our animations will run one cycle, meaning that each span will be shown once for three seconds, hence the delay value. The whole animation will run 6 (number of images) * 3 (appearance time) = 18 seconds.<br />
We will need to set the right percentage for the opacity value (or whatever makes the span appear). Dividing 6 by 18 gives us 0.333… which would be 33% for our keyframe step. Everything that we want to happen to the span needs to happen before that. So, after tweaking and seeing what fits best, we come up with the following animation for the first words:</p>
<pre class="brush:css">
@keyframes rotateWordsFirst {
    0% { opacity: 1; animation-timing-function: ease-in; height: 0px; }
    8% { opacity: 1; height: 60px; }
    19% { opacity: 1; height: 60px; }
	25% { opacity: 0; height: 60px; }
    100% { opacity: 0; }
}
</pre>
<p>We&#8217;ll fade in the span and we&#8217;ll also animate its height.</p>
<p>The animation for the words in the second div will fade in and animate their width. We added a bit to the keyframe step percentages here, because we want these words to appear just a tiny bit later than the ones of the first word:</p>
<pre class="brush:css">
@keyframes rotateWordsSecond {
    0% { opacity: 1; animation-timing-function: ease-in; width: 0px; }
    10% { opacity: 0.3; width: 0px; }
	20% { opacity: 1; width: 100%; }
    27% { opacity: 0; width: 100%; }
    100% { opacity: 0; }
}
</pre>
<p>And that&#8217;s it folks! There are many possibilities for the animations, you can check out the other demos and see what can be applied!</p>
<h3>Demos</h3>
<ol>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3RotatingWords/index.html">Demo 1: Animate down</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3RotatingWords/index2.html">Demo 2: Animate height and width</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3RotatingWords/index3.html">Demo 3: Fade in and &#8220;fall&#8221;</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3RotatingWords/index4.html">Demo 4: Animate width and fly in</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3RotatingWords/index5.html">Demo 5: Rotate in 3D and &#8220;sharpen&#8221;</a></strong></li>
</ol>
<p>I hope you enjoyed this tutorial and find it inspiring! </p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3RotatingWords/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3RotatingWords/CSS3RotatingWords.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/04/17/rotating-words-with-css-animations/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
		<item>
		<title>Animated Content Tabs with CSS3</title>
		<link>http://tympanus.net/codrops/2012/04/12/animated-content-tabs-with-css3/</link>
		<comments>http://tympanus.net/codrops/2012/04/12/animated-content-tabs-with-css3/#comments</comments>
		<pubDate>Thu, 12 Apr 2012 11:27:45 +0000</pubDate>
		<dc:creator>Ring Wing</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[pseudo-class]]></category>
		<category><![CDATA[sibling combinator]]></category>
		<category><![CDATA[tabs]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=8350</guid>
		<description><![CDATA[In this tutorial we are going to implement some simple CSS3 content tabs using radio buttons together with the :checked pseudo-class and sibling combinators.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/CSS3ContentTabs/"><br />
<img src="http://tympanus.net/codrops/wp-content/uploads/2012/04/CSS3ContentTabs.jpg" alt="CSS3 Content Tabs" title="CSS3 Content Tabs" width="580" height="315" class="alignnone size-full wp-image-8386" /><br />
</a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3ContentTabs/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3ContentTabs/CSS3ContentTabs.zip">Download source</a></p>
<p>Content tabs are a very common and familiar element in web design, and often their turn out to be pretty useful. So, in this tutorial we are going to implement some simple CSS3 content tabs using <strong>radio buttons</strong> together with the <strong>:checked pseudo-class</strong> and <strong>sibling combinators</strong>. </p>
<p><em>Note that the CSS3 properties will only work in browsers that support them.</em></p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>We will be using <strong>input</strong> elements to connect to the division with the class <strong>content</strong>. The content division includes all of the &#8220;tab pages&#8221;. For each input element we&#8217;ll have a <strong>label</strong> element. All labels will be styled like tabs.</p>
<pre class="brush:xml">
&lt;section class="tabs"&gt;
    &lt;input id="tab-1" type="radio" name="radio-set" class="tab-selector-1" checked="checked" /&gt;
	&lt;label for="tab-1" class="tab-label-1"&gt;About us&lt;/label&gt;

	&lt;input id="tab-2" type="radio" name="radio-set" class="tab-selector-2" /&gt;
	&lt;label for="tab-2" class="tab-label-2"&gt;How we work&lt;/label&gt;

	&lt;input id="tab-3" type="radio" name="radio-set" class="tab-selector-3" /&gt;
	&lt;label for="tab-3" class="tab-label-3"&gt;References&lt;/label&gt;

	&lt;input id="tab-4" type="radio" name="radio-set" class="tab-selector-4" /&gt;
	&lt;label for="tab-4" class="tab-label-4"&gt;Contact us&lt;/label&gt;

	&lt;div class="clear-shadow"&gt;&lt;/div&gt;

	&lt;div class="content"&gt;
		&lt;div class="content-1"&gt;
            &lt;p&gt;Some content&lt;/p&gt;
		&lt;/div&gt;
		&lt;div class="content-2"&gt;
            &lt;p&gt;Some content&lt;/p&gt;
		&lt;/div&gt;
		&lt;div class="content-3"&gt;
            &lt;p&gt;Some content&lt;/p&gt;
		&lt;/div&gt;
		&lt;div class="content-4"&gt;
            &lt;p&gt;Some content&lt;/p&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/section&gt;
</pre>
<p>Every input element has a value, and we can always make an input selected by default by adding the  <strong>checked</strong> attribute.</p>
<h3>The CSS</h3>
<p>The first thing we need to do is to define some dimension and hide the inputs by setting their opacity to 0: </p>
<pre class="brush:css">
tabs {
    position: relative;
	margin: 40px auto;
	width: 750px;
}

.tabs input {
	position: absolute;
	z-index: 1000;
	width: 120px;
	height: 40px;
	left: 0px;
	top: 0px;
	opacity: 0;
	cursor: pointer;
}
.tabs input#tab-2{
	left: 120px;
}
.tabs input#tab-3{
	left: 240px;
}
.tabs input#tab-4{
	left: 360px;
}
</pre>
<p>The inputs will be covering the labels. It will seem, as if we click on the label, but actually we are clicking on the input. This is a trick that will also work in mobile browsers (in some mobile browsers, simply clicking the label will not focus the associated input).</p>
<p>Next, we will make the labels look like tabs by defining some neat style for them. Note that each of the labels has a different <strong>z-index</strong>. A box-shadow will add depth and realism to the tabs.</p>
<pre class="brush:css">
.tabs label {
	background: linear-gradient(top, #5ba4a4 0%,#4e8c8a 100%);
	font-size: 15px;
	line-height: 40px;
	height: 40px;
	position: relative;
	padding: 0 20px;
    float: left;
	display: block;
	width: 80px;
	color: #385c5b;
	letter-spacing: 1px;
	text-transform: uppercase;
	font-weight: bold;
	text-align: center;
	text-shadow: 1px 1px 1px rgba(255,255,255,0.3);
    border-radius: 3px 3px 0 0;
    box-shadow: 2px 0 2px rgba(0,0,0,0.1), -2px 0 2px rgba(0,0,0,0.1);
}

.tabs input:hover + label {
	background: #5ba4a4;
}

.tabs label:first-of-type {
    z-index: 4;
    box-shadow: 2px 0 2px rgba(0,0,0,0.1);
}

.tab-label-2 {
    z-index: 3;
}

.tab-label-3 {
    z-index: 2;
}

.tab-label-4 {
    z-index: 1;
}
</pre>
<p>Since we don&#8217;t want the bottom part of the box-shadow to show, we will cover it by using a :after pseudo-element with no content:</p>
<pre class="brush:css">
.tabs label:after {
    content: '';
	background: #fff;
	position: absolute;
	bottom: -2px;
	left: 0;
	width: 100%;
	height: 2px;
	display: block;
}
</pre>
<p>When we click on a tab (label), it will be different in style and color from the others. The important thing is to make sure that the &#8220;checked&#8221; label will be on top of all of the other layers in the tabs. So, we will give it the highest z-index:</p>
<pre class="brush:css">
.tabs input:checked + label {
    background: #fff;
	z-index: 6;
}
</pre>
<p>As mentioned before, the content division will contain all of the tab pages, and we will set its <strong>z-index</strong> to 5, just to be under the selected label. In this way, the box-shadow of content area will cover all of the other labels. </p>
<p>Inside the content area, there are four divisions and each of them has their own content. By default (when their respective label is not selected/clicked) we want them to be hidden. So, we set the <strong>opacity</strong> to zero and the z-index to 1. We cannot use the <em>display: none</em> property because it&#8217;s not supported in <em>transitions</em>.</p>
<pre class="brush:css">
.content {
    background: #fff;
	position: relative;
    width: 100%;
	height: 370px;
	z-index: 5;
    box-shadow: 0 -2px 3px -2px rgba(0,0,0,0.2), 0 2px 2px rgba(0,0,0,0.1);
    border-radius: 0 3px 3px 3px;
}

.content div {
    position: absolute;
	top: 0;
	left: 0;
	padding: 10px 40px;
	z-index: 1;
    opacity: 0;
    transition: all linear 0.1s;
}

.content div h2,
.content div h3{
	color: #398080;
}
.content div p {
	font-size: 14px;
	line-height: 22px;
	font-style: italic;
	text-align: left;
	margin: 0;
	color: #777;
	padding-left: 15px;
	font-family: Cambria, Georgia, serif;
	border-left: 8px solid rgba(63,148,148, 0.1);
}
</pre>
<p>When we want a content to appear (label clicked) we set the <strong>opacity</strong> to 1 and raise the z-index because we want this content division to be on top of all the others:</p>
<pre class="brush:css">
.tabs input.tab-selector-1:checked ~ .content .content-1,
.tabs input.tab-selector-2:checked ~ .content .content-2,
.tabs input.tab-selector-3:checked ~ .content .content-3,
.tabs input.tab-selector-4:checked ~ .content .content-4 {
    z-index: 100;
    opacity: 1;
    transition: all ease-out 0.2s 0.1s;
}
</pre>
<p>In this tutorial we just went through the basic example that will fade in/out the contents. You can find more styles and effects in the demos.</p>
<p>This tutorial is part of the CSS3 series on Codrops. Check out the other experiments:</p>
<ul>
<li><a href="http://tympanus.net/codrops/2012/03/23/responsive-content-navigator-with-css3/" title="Responsive Content Navigator with CSS3">Responsive Content Navigator with CSS3</a></li>
<li><a href="http://tympanus.net/codrops/2012/02/21/accordion-with-css3/" title="Accordion with CSS3">Accordion with CSS3</a></li>
<li><a href="http://tympanus.net/codrops/2012/01/30/page-transitions-with-css3/" title="Page Transitions with CSS3">Page Transitions with CSS3</a></li>
<li><a href="http://tympanus.net/codrops/2012/01/17/sliding-image-panels-with-css3/" title="Sliding Image Panels with CSS3">Sliding Image Panels with CSS3</a></li>
<li><a href="http://tympanus.net/codrops/2012/01/10/animated-web-banners-with-css3/" title="Animated Web Banners With CSS3">Animated Web Banners With CSS3</a></li>
<li><a href="http://tympanus.net/codrops/2012/01/09/filter-functionality-with-css3/" title="Filter Functionality with CSS3">Filter Functionality with CSS3</a></li>
<li><a href="http://tympanus.net/codrops/2012/01/02/fullscreen-background-image-slideshow-with-css3/" title="Fullscreen Background Image Slideshow with CSS3">Fullscreen Background Image Slideshow with CSS3</a></li>
<li><a href="http://tympanus.net/codrops/2011/12/26/css3-lightbox/" title="CSS3 Lightbox">CSS3 Lightbox</a></li>
<li><a href="http://tympanus.net/codrops/2011/12/07/splash-and-coming-soon-page-effects-with-css3/" title="Splash and Coming Soon Page Effects with CSS3">Splash and Coming Soon Page Effects with CSS3</a></li>
<li><a href="http://tympanus.net/codrops/2011/11/02/original-hover-effects-with-css3/" title="Original Hover Effects with CSS3">Original Hover Effects with CSS3</a></li>
<li><a href="http://tympanus.net/codrops/2011/11/07/animated-buttons-with-css3/" title="Animated Buttons with CSS3">Animated Buttons with CSS3</a></li>
<li><a href="http://tympanus.net/codrops/2011/10/24/creative-css3-animation-menus/" title="Creative CSS3 Animation Menus">Creative CSS3 Animation Menus</a></li>
<li><a href="http://tympanus.net/codrops/2011/10/19/blur-menu-with-css3-transitions/" title="Blur Menu with CSS3 Transitions">Blur Menu with CSS3 Transitions</a></li>
</ul>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3ContentTabs/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3ContentTabs/CSS3ContentTabs.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/04/12/animated-content-tabs-with-css3/feed/</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
		<item>
		<title>Slideshow with jmpress.js</title>
		<link>http://tympanus.net/codrops/2012/04/05/slideshow-with-jmpress-js/</link>
		<comments>http://tympanus.net/codrops/2012/04/05/slideshow-with-jmpress-js/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 16:17:16 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[responsive]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=8265</guid>
		<description><![CDATA[Today we will create a slideshow using jmpress.js. The jQuery plugin that is based on impress.js will allow us to use some interesting 3D effects for the slides.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/SlideshowJmpress/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/04/SlideshowJmpress.jpg" alt="Slideshow with Jmpress" title="Slideshow with Jmpress" width="580" height="315" class="alignnone size-full wp-image-8272" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/SlideshowJmpress/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/SlideshowJmpress/SlideshowJmpress.zip">Download source</a></p>
<p>You have for sure already seen <a href="http://bartaz.github.com/impress.js/">impress.js</a>, a really great JavaScript library for creating extraordinary 3D presentations. The jQuery port <a href="http://shama.github.com/jmpress.js">jmpress.js</a> let&#8217;s you use this library as a jQuery plugin with some added options. We want to show you today how to use this great plugin to create a responsive slideshow with 3D effects. </p>
<p>The icons used in the demo is by <a href="http://blog.artcore-illustrations.de/aicons/">Artcore Illustration</a> and they are licensed under the<br />
<a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons BY-NC-ND 3.0 license</a>.</p>
<p>So, let&#8217;s start!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>We will have a main container which is a section with the class <strong>jms-slideshow</strong>. Inside, we&#8217;ll have sevaral divisions with the class <strong>step</strong>. These will be our single slides. Each step or slide will get a data-color class for it&#8217;s background color and some data attributes of jmpress.js. You can find all (inline) options here: <a href="http://shama.github.com/jmpress.js/docs/#options">jmpress.js Documentation &#8211; Options</a>. We&#8217;ll use some attributes in order to define the position and rotation of the slides in 3D space:</p>
<pre class="brush:xml">
&lt;section id="jms-slideshow" class="jms-slideshow"&gt;

	&lt;div class="step" data-color="color-1"&gt;
		&lt;div class="jms-content"&gt;
			&lt;h3&gt;Some headline&lt;/h3&gt;
			&lt;p&gt;Some text&lt;/p&gt;
			&lt;a class="jms-link" href="#"&gt;Read more&lt;/a&gt;
		&lt;/div&gt;
		&lt;img src="images/1.png" /&gt;
	&lt;/div&gt;

	&lt;div class="step" data-color="color-2" data-y="500" data-scale="0.4" data-rotate-x="30"&gt;
		&lt;!-- ... --&gt;
	&lt;/div&gt;

	&lt;!-- ... --&gt;

&lt;/section&gt;
</pre>
<p>Let&#8217;s take care of the style.</p>
<h3>The CSS</h3>
<p>Since we want to make the slideshow responsive, we will give the main container a percentage width, with some min and max values:</p>
<pre class="brush:css">
.jms-slideshow {
	position: relative;
	width: 80%;
	max-width: 1400px;
	min-width: 640px;
	margin: 20px auto;
	height: 460px;
}
</pre>
<p>The next wrapper is dynamically added, and this will be the visible slideshow wrapper:</p>
<pre class="brush:css">
.jms-wrapper {
	width: auto;
	min-width: 600px;
	height: 440px;
	background-color: #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
	-webkit-background-clip: padding;
	-moz-background-clip: padding;
	background-clip: padding-box;
	border: 10px solid #fff;
	border: 10px solid rgba(255, 255, 255, 0.9);
	outline: none;
	transition: background-color 1s linear;
}
</pre>
<p>The background color classes will be applied to the previous wrapper. The class is defined in the data atrribute <strong>data-color</strong> in each step. This gives us the possibility to add a background color for each slide and change it with a transition. (The duration of the transition will be re-defined in the JavaScript.)</p>
<pre class="brush:css">
.color-1 {
	background-color: #E3D8FF;
	background-color: rgba(227, 216, 268, 1);
}
.color-2 {
	background-color: #EBBBBC;
	background-color: rgba(235, 187, 188, 1);
}
.color-3 {
	background-color: #EED9C0;
	background-color: rgba(238, 217, 192, 1);
}
.color-4 {
	background-color: #DFEBB1;
	background-color: rgba(223, 235, 177, 1);
}
.color-5{
	background-color: #C1E6E5;
	background-color: rgba(193, 230, 229, 1);
}
</pre>
<p>The steps will have the following style:</p>
<pre class="brush:css">
.step {
	width: 900px;
    height: 420px;
	display: block;
	transition: opacity 1s;
}
.step:not(.active) {
	opacity: 0;
}
</pre>
<p>Inactive steps will have 0 opacity. When the slides are moved, the opacity will be set to 1.</p>
<p>The inner parts of the slides will have the following style:</p>
<pre class="brush:css">
.jms-content{
	margin: 0px 370px 0px 20px;
	position: relative;
	clear: both;
}
.step h3{
	color: #fff;
	font-size: 52px;
	font-weight: bold;
	text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
	margin: 0;
	padding: 60px 0 10px 0;
}
.step p {
	color: #fff;
	text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
	font-size: 34px;
	font-weight: normal;
	position: relative;
	margin: 0;
}
</pre>
<p>The &#8220;read more&#8221; link will have a little transition by itself: once a step becomes active, it will move up wile fading in:</p>
<pre class="brush:css">
a.jms-link{
	color: #fff;
	text-transform: uppercase;
	background: linear-gradient(top, #969696 0%,#727272 100%);
	padding: 8px 15px;
	display: inline-block;
	font-size: 16px;
	font-weight: bold;
	color: #fff;
	text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
	box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
	border: 1px solid #444;
	border-radius: 4px;
	opacity: 1;
	margin-top: 40px;
	clear: both;
	transition: all 0.4s ease-in-out 1s;
}
.step:not(.active) a.jms-link{
	opacity: 0;
	margin-top: 80px;
}
</pre>
<p>The image will be positioned absolutely on the right side of each slide:</p>
<pre class="brush:css">
.step img{
	position: absolute;
	right: 0px;
	top: 30px;
}
</pre>
<p>The navigation dots will positioned at the bottom:</p>
<pre class="brush:css">
.jms-dots{
	width: 100%;
	position: absolute;
	text-align: center;
	left: 0px;
	bottom: 20px;
	z-index: 2000;
	user-select: none;
}
</pre>
<p>With &#8220;user-select: none&#8221; the text of an element and its sub-elements will appear as if they can&#8217;t be selected.<br />
The span will be a dark little dot:</p>
<pre class="brush:css">
.jms-dots span{
	display: inline-block;
	position: relative;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #777;
	margin: 3px;
	cursor: pointer;
	box-shadow:
		1px 1px 1px rgba(0,0,0,0.1) inset,
		1px 1px 1px rgba(255,255,255,0.3);
}
</pre>
<p>And we&#8217;ll style a pseudo-element to look like a little white dot:</p>
<pre class="brush:css">
.jms-dots span.jms-dots-current:after{
	content: '';
	width: 8px;
	height: 8px;
	position: absolute;
	top: 2px;
	left: 2px;
	border-radius: 50%;
	background: linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
}
</pre>
<p>The arrow navigation spans will be positioned on the left and on the right side of the slideshow. We&#8217;ll use background images for the arrows:</p>
<pre class="brush:css">
.jms-arrows{
	user-select: none;
}
.jms-arrows span{
	position: absolute;
	top: 50%;
	margin-top: -40px;
	height: 80px;
	width: 30px;
	cursor: pointer;
	z-index: 2000;
	box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
	border-radius: 3px;
}
.jms-arrows span.jms-arrows-prev{
	background: #fff url(../images/arrow_left.png) no-repeat 50% 50%;
	left: -10px;
}
.jms-arrows span.jms-arrows-next{
	background: #fff url(../images/arrow_right.png) no-repeat 50% 50%;
	right: -10px;
}
</pre>
<p>Now we have styled the slideshow. Let&#8217;s move on to the JavaScript!</p>
<h3>The JavaScript</h3>
<p>We will be using the jmpress.js plugin to create our slideshow. Although you can make use of a lot of its functionality, we will just use the necessary parts to build our script. You can read more about the possibilities and options that jmpress.js offers <a href="http://shama.github.com/jmpress.js/" target="_blank">here</a>.</p>
<p>We will create a jQuery plugin for the slideshow. We can call the plugin like this:</p>
<pre class="brush:js">
$( '#jms-slider' ).jmslideshow();
</pre>
<p>The options for the jmpress plugin are defined as default options in our plugin (note that you can specify <a href="http://shama.github.com/jmpress.js/docs/#options" target="_blank">more</a> than the ones listed):</p>
<pre class="brush:js">

jmpressOpts	: {
	// set the viewport
	viewPort 		: {
		height	: 400,
		width	: 1300,
		maxScale: 1
	},
	fullscreen		: false,
	hash			: { use : false },
	mouse			: { clickSelects : false },
	keyboard		: { use : false },
	animation		: { transitionDuration : '1s' }
},
</pre>
<p>You can either change them inside the slideshow plugin, or pass a specific value when you initialize the plugin. As an example:</p>
<pre class="brush:js">

// specify the jmpress options
var jmpressOpts	= {
	animation		: { transitionDuration : '0.8s' }
};

// call the jmslideshow plugin
$( '#jms-slideshow' ).jmslideshow( $.extend( true, { jmpressOpts : jmpressOpts }, {
	autoplay	: true,
	bgColorSpeed: '0.8s',
	arrows		: false
}));
</pre>
<p>The following are the set of available options that are available for the slideshow plugin:</p>
<pre class="brush:js">

$.JMSlideshow.defaults 		= {
	// options for the jmpress plugin.
	// you can add more options...
	jmpressOpts	: {
		// set the viewport
		viewPort 		: {
			height	: 400,
			width	: 1300,
			maxScale: 1
		},
		fullscreen		: false,
		hash			: { use : false },
		mouse			: { clickSelects : false },
		keyboard		: { use : false },
		animation		: { transitionDuration : '1s' }
	},
	// for this specific plugin we will have the following options:
	// shows/hides navigation arrows
	arrows		: true,
	// shows/hides navigation dots/pages
	dots		: true,
	// each step's bgcolor transition speed
	bgColorSpeed: '1s',
	// slideshow on / off
	autoplay	: false,
	// time between transitions for the slideshow
	interval	: 3500
};
</pre>
<p>Once the slideshow plugin is called, the first function to be executed is the init function:</p>
<pre class="brush:js">

_init : function( options ) {

	this.options 		= $.extend( true, {}, $.JMSlideshow.defaults, options );

	// the slides
	this.$slides		= $('#jms-slider').children('div');
	// total number of slides
	this.slidesCount	= this.$slides.length;
	// step's bgcolor
	this.colors			= $.map( this.$slides, function( el, i ) { return $( el ).data( 'color' ); } ).join( ' ' );
	// build the necessary structure to run jmpress
	this._layout();
	// initialize the jmpress plugin
	this._initImpress();
	// if support (function implemented in jmpress plugin)
	if( this.support ) {

		// load some events
		this._loadEvents();
		// if autoplay is true start the slideshow
		if( this.options.autoplay ) {

			this._startSlideshow();

		}

	}

},
</pre>
<p>In the _layout function we are building the necessary structure for the jmpress plugin. Also, we will be adding the navigation arrows / dots in case these are set to true in the options.</p>
<pre class="brush:js">

_layout				: function() {

	// adds a specific class to each one of the steps
	this.$slides.each( function( i ) {

		$(this).addClass( 'jmstep' + ( i + 1 ) );

	} );

	// wrap the slides. This wrapper will be the element on which we will call the jmpress plugin
	this.$jmsWrapper	= this.$slides.wrapAll( '&lt;div class="jms-wrapper"/&gt;' ).parent();

	// transition speed for the wrapper bgcolor
	this.$jmsWrapper.css( {
		'-webkit-transition-duration' 	: this.options.bgColorSpeed,
		'-moz-transition-duration' 		: this.options.bgColorSpeed,
		'-ms-transition-duration' 		: this.options.bgColorSpeed,
		'-o-transition-duration' 		: this.options.bgColorSpeed,
		'transition-duration' 			: this.options.bgColorSpeed
	} );

	// add navigation arrows
	if( this.options.arrows ) {

		this.$arrows	= $( '&lt;nav class="jms-arrows"/&gt;' );

		if( this.slidesCount > 1 ) {

			this.$arrowPrev	= $( '&lt;span class="jms-arrows-prev"/&gt;' ).appendTo( this.$arrows );
			this.$arrowNext	= $( '&lt;span class="jms-arrows-next"/&gt;' ).appendTo( this.$arrows );

		}

		this.$el.append( this.$arrows )

	}

	// add navigation dots
	if( this.options.dots ) {

		this.$dots		= $( '&lt;nav class="jms-dots"/&gt;' );

		for( var i = this.slidesCount + 1; --i; ) {

			this.$dots.append( ( i === this.slidesCount ) ? '&lt;span class="jms-dots-current"/&gt;' : '&lt;span/&gt;' );

		}

		if( this.options.jmpressOpts.start ) {

			this.$start		= this.$jmsWrapper.find( this.options.jmpressOpts.start ), idxSelected = 0;

			( this.$start.length ) ? idxSelected = this.$start.index() : this.options.jmpressOpts.start = null;

			this.$dots.children().removeClass( 'jms-dots-current' ).eq( idxSelected ).addClass( 'jms-dots-current' );

		}

		this.$el.append( this.$dots )

	}

},
</pre>
<p>We will initialize the jmpress plugin in the _initImpress function. We will also redefine the &#8220;setActive&#8221; method of jmpress in order to switch the active navigation dot.</p>
<pre class="brush:js">

_initImpress		: function() {

	var _self = this;

	this.$jmsWrapper.jmpress( this.options.jmpressOpts );
	// check if supported (function from jmpress.js):
	// it adds the class not-suported to the wrapper
	this.support	= !this.$jmsWrapper.hasClass( 'not-supported' );

	// if not supported remove unnecessary elements
	if( !this.support ) {

		if( this.$arrows ) {

			this.$arrows.remove();

		}

		if( this.$dots ) {

			this.$dots.remove();

		}

		return false;

	}

	// redefine the jmpress setActive method
	this.$jmsWrapper.jmpress( 'setActive', function( slide, eventData ) {

		// change the pagination dot active class
		if( _self.options.dots ) {

			// adds the current class to the current dot/page
			_self.$dots
				 .children()
				 .removeClass( 'jms-dots-current' )
				 .eq( slide.index() )
				 .addClass( 'jms-dots-current' );

		}

		// delete all current bg colors
		this.removeClass( _self.colors );
		// add bg color class
		this.addClass( slide.data( 'color' ) );

	} );

	// add step's bg color to the wrapper
	this.$jmsWrapper.addClass( this.$jmsWrapper.jmpress('active').data( 'color' ) );

},
</pre>
<p>The _startSlideshow and _stopSlideshow will start and stop the slideshow respectively if the option autoplay is set to true.</p>
<pre class="brush:js">

// start slideshow if autoplay is true
	_startSlideshow		: function() {

		var _self	= this;

		this.slideshow	= setTimeout( function() {

			_self.$jmsWrapper.jmpress( 'next' );

			if( _self.options.autoplay ) {

				_self._startSlideshow();

			}

		}, this.options.interval );

	},
	// stops the slideshow
	_stopSlideshow		: function() {

		if( this.options.autoplay ) {

			clearTimeout( this.slideshow );
			this.options.autoplay	= false;

		}

	},
</pre>
<p>Finally, we load the events for the navigation arrows and dots. The touchend event is already defined in the jmpress plugin, but we will need to stop the slideshow in case this event is triggered: </p>
<pre class="brush:js">

_loadEvents			: function() {

	var _self = this;

	// navigation arrows
	if( this.$arrowPrev &#038;&#038; this.$arrowNext ) {

		this.$arrowPrev.on( 'click.jmslideshow', function( event ) {

			_self._stopSlideshow();

			_self.$jmsWrapper.jmpress( 'prev' );

			return false;

		} );

		this.$arrowNext.on( 'click.jmslideshow', function( event ) {

			_self._stopSlideshow();

			_self.$jmsWrapper.jmpress( 'next' );

			return false;

		} );

	}

	// navigation dots
	if( this.$dots ) {

		this.$dots.children().on( 'click.jmslideshow', function( event ) {

			_self._stopSlideshow();

			_self.$jmsWrapper.jmpress( 'goTo', '.jmstep' + ( $(this).index() + 1 ) );

			return false;

		} );

	}

	// the touchend event is already defined in the jmpress plugin.
	// we just need to make sure the slideshow stops if the event is triggered
	this.$jmsWrapper.on( 'touchend.jmslideshow', function() {

		_self._stopSlideshow();

	} );

}
</pre>
<p>And that&#8217;s it! I hope you enjoyed this tutorial and find it useful!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/SlideshowJmpress/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/SlideshowJmpress/SlideshowJmpress.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/04/05/slideshow-with-jmpress-js/feed/</wfw:commentRss>
		<slash:comments>79</slash:comments>
		</item>
		<item>
		<title>Responsive Horizontal Layout</title>
		<link>http://tympanus.net/codrops/2012/04/02/responsive-horizontal-layout/</link>
		<comments>http://tympanus.net/codrops/2012/04/02/responsive-horizontal-layout/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 15:10:26 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[horizontal]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[media queries]]></category>
		<category><![CDATA[responsive]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=8240</guid>
		<description><![CDATA[In this tutorial we'll create a horizontal website layout with individually scrollable content panels. We'll change the layout for smaller screens, making it responsive.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/ResponsiveHorizontalLayout/"><img src="http://tympanus.net/codrops/wp-content/uploads/2012/04/HorizontalStackLayout.jpg" alt="Responsive Horizontal Layout" title="Responsive Horizontal Layout" width="580" height="315" class="alignnone size-full wp-image-8246" /></a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/ResponsiveHorizontalLayout/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/ResponsiveHorizontalLayout/ResponsiveHorizontalLayout.zip">Download source</a></p>
<p>Today we want to show you how to create a horizontal layout with several content panels. The idea is to make each panel individually scrollable and animate a content panel to the left of the viewport once it&#8217;s clicked or selected from the menu. The challenge is to deal with different viewport sizes meaning that we will change the layout if the screen is not wide enough in order to be stacked vertically instead of horizontally. </p>
<p>We will be using a couple of useful jQuery plugins:</p>
<ul>
<li><a href="https://github.com/balupton/history.js">History.js by Benjamin Lupton</a></li>
<li><a href="http://jscrollpane.kelvinluck.com/">jScrollPane by Kelvin Luck</a></li>
<li><a href="https://github.com/balupton/jquery-sparkle">jquery-sparkle by Benjamin Lupton</a></li>
<li><a href="http://gsgd.co.uk/sandbox/jquery/easing/">jquery.easing</a></li>
<li><a href="https://github.com/louisremi/jquery-smartresize">jquery.smartresize by Louis Remi</a></li>
</ul>
<p>In the demo we are using Charles Darwin&#8217;s <em>The Origin of Species by means of Natural Selection, 6th Edition</em> which you can find as an e-book on <a href="http://www.gutenberg.org/ebooks/2009">Project Gutenberg</a>.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>The HTML will be built up of a menu that will be fixed at the left side and a container with all the individual panels inside. All will be wrapped by a main container:</p>
<pre class="brush:xml">
&lt;div id="hs-container" class="hs-container"&gt;

	&lt;!-- ... --&gt;

&lt;/div&gt;
</pre>
<p>The menu will have the following structure:</p>
<pre class="brush:xml">
&lt;aside class="hs-menu" id="hs-menu"&gt;

	&lt;div class="hs-headline"&gt;
		&lt;h1&gt;
			&lt;small&gt;The&lt;/small&gt;
			Origin &lt;small&gt;of&lt;/small&gt;
			Species
		&lt;/h1&gt;
		&lt;small&gt;6&lt;sup&gt;th&lt;/sup&gt; Edition&lt;/small&gt;
		&lt;span class="author"&gt;by Charles Darwin&lt;/span&gt;
	&lt;/div&gt;

	&lt;nav&gt;
		&lt;a href="#introduction"&gt;
			&lt;span&gt;Introduction&lt;/span&gt;
		&lt;/a&gt;
		&lt;a href="#chapter1"&gt;
			&lt;span&gt;Chapter I.&lt;/span&gt;
			&lt;span&gt;Variation under Domestication&lt;/span&gt;
		&lt;/a&gt;
		&lt;a href="#chapter2"&gt;
			&lt;span&gt;Chapter II.&lt;/span&gt;
			&lt;span&gt;Variation Under Nature &lt;/span&gt;
		&lt;/a&gt;
		&lt;!-- ... --&gt;
	&lt;/nav&gt;

&lt;/aside&gt;

&lt;a href="#hs-menu" class="hs-totop-link"&gt;Go to the top&lt;/a&gt;
</pre>
<p>We&#8217;ll have a headline and a navigation. We&#8217;ve also added a loose helper link that we&#8217;ll need to show for smaller screens where we will stack the content vertically.</p>
<p>The content will have the following structure:</p>
<pre class="brush:xml">
&lt;div class="hs-content-scroller"&gt;

	&lt;div class="hs-content-wrapper"&gt;

		&lt;article class="hs-content" id="introduction"&gt;
			&lt;div class="hs-inner"&gt;
				&lt;h2&gt;Introduction&lt;/h2&gt;
				&lt;p&gt;...&lt;/p&gt;
			&lt;/div&gt;
		&lt;/article&gt;

		&lt;article class="hs-content" id="chapter1"&gt;
			&lt;div class="hs-inner"&gt;
				&lt;h2&gt;Chapter I.&lt;/h2&gt;
				&lt;h3&gt;Variation Under Domestication&lt;/h3&gt;
				&lt;h4&gt;Causes of Variability&lt;/h4&gt;
				&lt;p&gt;...&lt;/p&gt;
			&lt;/div&gt;
		&lt;/article&gt;

		&lt;!-- ... --&gt;

	&lt;/div&gt;

&lt;/div&gt;
</pre>
<p>The first wrapper with the class <strong>hs-content-scroller</strong> will act like a mask, having the width and height that is visible in the viewport. This will be the division that we&#8217;ll scroll horizontally because the second wrapper with the class <strong>hs-content-wrapper</strong> will be as wide as the sum of all article widths. </p>
<p>As you can see, each article will get an ID which we link to in our navigation.</p>
<p>Let&#8217;s style this thing.</p>
<h3>The CSS</h3>
<p>So, our main aim is to fix the sidebar at the left side of the screen and place the content as a horizontal stack.<br />
Let&#8217;s first style the body and some headings. We&#8217;ll set both, overflow-x and overflow-y to hidden. We use the separate properties instead of the single &#8220;overflow&#8221; because we want to adjust something in a media query later, but we&#8217;ll get back to that.</p>
<p>We&#8217;ll first import the <a href="http://necolas.github.com/normalize.css/">normalize.css</a>, a really nice and sensible alternative to the common resets:</p>
<pre class="brush:css">
@import url('normalize.css');

body{
	font-family: Baskerville, "Hoefler Text", Garamond, "Times New Roman", serif;
	background: #e9f0f5 url(../images/pattern.png) repeat top left;
	font-weight: 400;
	font-size: 12px;
	color: #333;
	overflow-y: hidden;
	overflow-x: hidden;
}
</pre>
<p>Next, let&#8217;s define some general text styles:</p>
<pre class="brush:css">
h1, h3, h4{
	font-weight: 400;
}
h1{
	font-style: italic;
	border-bottom: 1px solid rgba(126, 126, 126, 0.3);
	padding: 35px 15px 15px 15px;
	margin: 0px 20px 20px 20px;
	position: relative;
	font-size: 38px;
}
h2{
	font-size: 40px;
	padding-bottom: 15px;
	border-bottom: 5px solid rgba(190, 211, 226, 0.2);
	color: #a9becd;
	text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.4);
	box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.4);
	font-weight: 700;
}
h3{
	font-style: italic;
	font-size: 26px;
	color: #585959;
	text-shadow: 1px 0px 1px rgba(255, 255, 255, 0.4);
}
h4{
	text-transform: uppercase;
	letter-spacing: 5px;
	line-height: 20px;
	padding: 10px 0px;
	color: #626a6f;
	border-bottom: 1px solid rgba(126, 126, 126, 0.1);
	box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.4);
}
a{
	color: #308fd9;
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 2px;
}
a:hover{
	color: #87b6da;
}
.hs-headline{
	text-align: center;
}
.hs-author{
	text-transform: uppercase;
	display: block;
	letter-spacing: 2px;
	font-weight: 700;
	padding: 20px 10px;
}
</pre>
<p>Now, let&#8217;s position the menu:</p>
<pre class="brush:css">
.hs-menu{
	position: fixed;
	z-index: 100;
	color: #f8f8f8;
	background: #131313;
	width: 200px;
	left: 0px;
	top: 0px;
	height: 100%;
}
</pre>
<p>Setting its position to fixed, we&#8217;ll stick the sidebar to the left side of the screen.<br />
The navigation will have the following style:</p>
<pre class="brush:css">
.hs-menu nav{
	position: absolute;
	top: 250px;
	left: 0px;
	right: 0px;
	bottom: 50px;
}
</pre>
<p>The position of the navigation will be absolute and by setting a top and bottom value, we have a flexible height. Later, we will add custom scrolling to the navigation so that we don&#8217;t have to worry about the menu items fitting into the area.</p>
<p>The anchors will have the following style:</p>
<pre class="brush:css">
.hs-menu nav a{
	display: block;
	padding: 10px 20px;
	text-align: center;
	outline: none;
	border-bottom: 1px dashed rgba(126, 126, 126, 0.2);
}
.hs-menu nav a:active{
	box-shadow: 7px 0px 17px #000 inset;
}
.hs-menu nav a:first-child{
	border-top: 1px dashed rgba(126, 126, 126, 0.2);
}
</pre>
<p>The second span in a navigation anchor will be styled differently:</p>
<pre class="brush:css">
.hs-menu nav a span:nth-child(2){
	display: block;
	color: #fff;
	font-style: italic;
	font-weight: 400;
	text-transform: none;
	padding-top: 3px;
}
</pre>
<p>Now, let&#8217;s style the content part. As mentioned before, the division with the class <strong>.hs-content-scroller</strong> will be acting as a mask where any overflow won&#8217;t be visible. This is basically the same principle as in sliders. The left will be set to 200 pixel because of the sidebar:</p>
<pre class="brush:css">
.hs-content-scroller{
	position: absolute;
	left: 200px;
	right: 0px;
	overflow: hidden;
	height: 100%;
}
</pre>
<p>The next wrapper will have a width which allows all the inner content panels to fit inside of it if stacked horizontally. We&#8217;ll set the overflow to hidden, because each of our content panels will have a custom scroll bar.</p>
<pre class="brush:css">
.hs-content-wrapper{
	width: 7950px;
	position: absolute;
	height: 100%;
	overflow: hidden;
}
</pre>
<p>Each content panel is going to have a width of 500 pixel and float left. We&#8217;ll add a transition for the background when we hover and when we add a active class:</p>
<pre class="brush:css">
.hs-content{
	width: 500px;
	overflow-y: scroll;
	height: 100%;
	float: left;
	border-right: 1px dashed rgba(126, 126, 126, 0.2);
	border-left: 1px dashed rgba(255, 255, 255, 0.5);
	background: transparent;
	transition: background 0.3s linear;
}
.hs-content:hover, .hs-content-active{
	background: #f1f5f8;
}
</pre>
<p>When we add the custom scrolling to the content panels, we only want them to be visible when we hover over them:</p>
<pre class="brush:css">
.hs-content:hover .jspVerticalBar,
.hs-menu nav:hover .jspVerticalBar{
	opacity: 1;
}
</pre>
<p>The first content panel will be a bit narrower:</p>
<pre class="brush:css">
.hs-content:first-child{
	width: 400px;
}
</pre>
<p>Let&#8217;s add some padding and style the text elements: </p>
<pre class="brush:css">
.hs-inner{
	padding: 30px 20px 10px 30px;
}
.hs-inner p{
	font-size: 18px;
	line-height: 24px;
	text-align: justify;
	position: relative;
	padding: 10px 0px;
	text-shadow: 1px 0px 1px rgba(255, 255, 255, 0.8);
}
.hs-inner p:first-letter{
	font-size: 28px;
}
#introduction .hs-inner p:first-of-type{
	font-size: 24px;
	text-align: left;
	line-height: 36px;
	font-style: italic;
	color: #75838D;
	letter-spacing: 0px;
}
</pre>
<p>Remember that little anchor right after the sidebar? When clicking that anchor, the page will scroll up. We&#8217;ll only need this anchor when our screen is not big enough to stack the content panels horizontally but only vertically, so we&#8217;ll set it to <em>display: none</em> initially. In a media query we&#8217;ll then show it. </p>
<pre class="brush:css">
a.hs-totop-link{
	display: none;
	position: fixed;
	z-index: 10000;
	bottom: 0px;
	width: 100%;
	height: 40px;
	line-height: 40px;
	font-size: 14px;
	color: #aaa;
	text-shadow: 1px 1px 1px #fff;
	font-weight: 700;
	cursor: pointer;
	text-transform: uppercase;
	text-align: center;
	background: linear-gradient(top, #ffffff 0%,#f3f3f3 50%,#ededed 51%,#ffffff 100%);
	border-top: 1px solid #cacaca;
}
</pre>
<p>When we reach the size of the iPad, we want to get rid of the hover behavior and show the horizontal scrollbar. This will allow us to &#8220;swipe&#8221; the content on the iPad:</p>
<pre class="brush:css">
/* Media Queries */
@media screen and (max-width: 1024px) {
	.jspVerticalBar{
		opacity: 1;
	}
	.hs-content-scroller{
		overflow-x: scroll;
	}
	.hs-content:hover{
		background: transparent;
	}
	.hs-content-active:hover {
		background: #f1f5f8;
	}
}
</pre>
<p>At this point, we&#8217;ll change the layout in order to be stacked vertically. We have to &#8220;reset&#8221; all the properties that forced the content to be stacked horizontally. We&#8217;ll also show the anchor that will bring us back to the top:</p>
<pre class="brush:css">
@media screen and (max-width: 715px) {
	body{
		overflow-x: auto;
		overflow-y: auto;
	}
	a.hs-totop-link{
		display: block;
	}
	.hs-menu{
		position: relative;
		width: 100%;
		height: 460px;
	}
	.hs-menu nav{
		top: 230px;
		bottom: 20px;
	}
	.hs-content-scroller{
		position: relative;
		height: auto;
		left: 0;
	}
	.hs-content-wrapper{
		height: auto;
		width: auto;
		margin-left: 0px;
	}
	.hs-content{
		border: none;
	}
	.hs-content, .hs-content:first-child{
		width: auto;
		float: none;
		overflow-y: auto;
	}
}
</pre>
<p>And that&#8217;s all the style! Now, let&#8217;s take a look at the JavaScript!</p>
<h3>The JavaScript</h3>
<p>First, we will set some variables and cache some elements:</p>
<pre class="brush:js">

var $container			= $( '#hs-container' ),
	// the scroll container that wraps the articles
	$scroller			= $container.find( 'div.hs-content-scroller' ),
	$menu				= $container.find( 'aside' ),
	// menu links
	$links				= $menu.find( 'nav > a' ),
	$articles			= $container.find( 'div.hs-content-wrapper > article' ),
	// button to scroll to the top of the page
	// only shown when screen size < 715
	$toTop				= $container.find( 'a.hs-totop-link' ),
	// the browser nhistory object
	History 			= window.History,
	// animation options
	animation			= { speed : 800, easing : 'easeInOutExpo' },
	// jScrollPane options
	scrollOptions		= { verticalGutter : 0, hideFocus : true },
</pre>
<p>The init function will be the first one to execute:</p>
<pre class="brush:js">

init				= function() {

	// initialize the jScrollPane on both the menu and articles
	_initCustomScroll();
	// initialize some events
	_initEvents();
	// sets some css properties
	_layout();
	// jumps to the respective chapter
	// according to the url
	_goto();

},
</pre>
<p>The first step is to create / initialize the jScrollPane (the custom scrollbars) on both the menu and the articles. However, for the articles, we will not do this in case the screen size is smaller than 715px:</p>
<pre class="brush:js">

_initCustomScroll	= function() {

	// Only add custom scrolling to articles if screen size > 715.
	// If not, the articles will be expanded (vertical layout)
	if( $(window).width() > 715 ) {

		$articles.jScrollPane( scrollOptions );

	}
	// add custom scrolling to menu
	$menu.children( 'nav' ).jScrollPane( scrollOptions );

},
</pre>
<p>We will load the events for the window, the menu links and the articles.</p>
<p>On window resize, we will need to reinitialize the jScrollPane custom scrollbars, or destroy them in case the screen's size gets smaller than 715px.</p>
<p>On window statechange, we will jump to the respective state / chapter. We are using <a href="https://github.com/balupton/history.js" target="_blank">History.js</a> by Benjamin Lupton to control the history states when the user navigates through the page:</p>
<pre class="brush:js">

$(window).on({
	// when resizing the window we need to reinitialize or destroy the jScrollPanes
	// depending on the screen size
	'smartresize' : function( event ) {

		_layout();

		$('article.hs-content').each( function() {

			var $article 	= $(this),
				aJSP		= $article.data( 'jsp' );

			if( $(window).width() > 715 ) {

				( aJSP === undefined ) ? $article.jScrollPane( scrollOptions ) : aJSP.reinitialise();

				_initArticleEvents();

			}
			else {

				// destroy article's custom scroll if screen size <= 715px
				if( aJSP !== undefined )
					aJSP.destroy();

				$container.off( 'click', 'article.hs-content' );

			}

		});

		var nJSP = $menu.children( 'nav' ).data( 'jsp' );
		nJSP.reinitialise();

		// jumps to the current chapter
		_goto();

	},
	// triggered when the history state changes - jumps to the respective chapter
	'statechange' : function( event ) {

		_goto();

	}
});
</pre>
<p>When we click on an article or menu link, we will check to which chapter it refers to, and we will change the state of the browser history object. This will trigger the statechange event which in turn will make the page / scrolling division jump to the respective area.</p>
<pre class="brush:js">

$links.on( 'click', function( event ) {

	var href		= $(this).attr('href'),
		chapter		= ( href.search(/chapter/) !== -1 ) ? href.substring(8) : 0;

	_saveState( chapter );

	return false;

});

$container.on( 'click', 'article.hs-content', function( event ) {

	var id			= $(this).attr('id'),
		chapter		= ( id.search(/chapter/) !== -1 ) ? id.substring(7) : 0;

	_saveState( chapter );

	return false;

});

_saveState			= function( chapter ) {

	// adds a new state to the history object
	// this will trigger the statechange on the window
	if( History.getState().url.queryStringToJSON().chapter !== chapter ) {

		History.pushState( null, null, '?chapter=' + chapter );

	}

},
</pre>
<p>We will also control the overflow property of the "scroller" (divison with class "hs-content-scroller") according to the screen size.</p>
<pre class="brush:js">

_layout				= function() {

	var windowWidth	= $(window).width();
	switch( true ) {

		case ( windowWidth <= 715 ) : $scroller.scrollLeft( 0 ).css( 'overflow', 'visible' ); break;
		case ( windowWidth <= 1024 ): $scroller.css( 'overflow-x', 'scroll' ); break;
		case ( windowWidth > 1024 ) : $scroller.css( 'overflow', 'hidden' ); break;

	};

},
</pre>
<p>The _goto function triggers the animation for changing the area / chapter on the page. We get the current chapter from the history state URL, and given the respective article we either scroll to the left or top depending on the screen size. Also, if we are in landscape mode, the element scrolling is the div "hs-content-scroller", otherwise it's the BODY element.</p>
<pre class="brush:js">

_goto				= function( chapter ) {

	// get the url from history state (e.g. chapter=3) and extract the chapter number
var chapter 	= chapter || History.getState().url.queryStringToJSON().chapter,
	isHome		= ( chapter === undefined ),
	// we will jump to the introduction chapter if theres no chapter
	$article 	= $( chapter ? '#' + 'chapter' + chapter : '#' + 'introduction' );

	if( $article.length ) {

			// left / top of the element
		var left		= $article.position().left,
			top			= $article.position().top,
			// check if we are scrolling down or left
			// is_v will be true when the screen size < 715
			is_v		= ( $(document).height() - $(window).height() > 0 ),
			// animation parameters:
			// if vertically scrolling then the body will animate the scrollTop,
			// otherwise the scroller (div.hs-content-scroller) will animate the scrollLeft
			param		= ( is_v ) ? { scrollTop : (isHome) ? top : top + $menu.outerHeight( true ) } : { scrollLeft : left },
			$elScroller	= ( is_v ) ? $( 'html, body' ) : $scroller;

		$elScroller.stop().animate( param, animation.speed, animation.easing, function() {

			// active class for selected chapter
			$articles.removeClass( 'hs-content-active' );
			$article.addClass( 'hs-content-active' );

		} );

	}

},
</pre>
<p>And that's it! I hope you enjoyed this tutorial and find it useful! </p>
<p><a class="demo" href="http://tympanus.net/Tutorials/ResponsiveHorizontalLayout/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/ResponsiveHorizontalLayout/ResponsiveHorizontalLayout.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/04/02/responsive-horizontal-layout/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Login and Registration Form with HTML5 and CSS3</title>
		<link>http://tympanus.net/codrops/2012/03/27/login-and-registration-form-with-html5-and-css3/</link>
		<comments>http://tympanus.net/codrops/2012/03/27/login-and-registration-form-with-html5-and-css3/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 12:45:23 +0000</pubDate>
		<dc:creator>Stéphanie Walter</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[target]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=8126</guid>
		<description><![CDATA[A tutorial on how to create a switching login and registration form with HTML5 and CSS3.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/LoginRegistrationForm/"><br />
<img src="http://tympanus.net/codrops/wp-content/uploads/2012/03/Form.jpg" alt="" title="Login and Registration Form with CSS3 and HTML5" width="580" height="315" class="alignnone size-full wp-image-8140" /><br />
</a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/LoginRegistrationForm/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/LoginRegistrationForm/LoginRegistrationForm.zip">Download source</a></p>
<p>In this tutorial we are going to create two HTML5 forms that will switch between login and registration using the CSS3 pseudo class <a href="http://www.w3.org/TR/selectors/#target-pseudo" title="Target selector W3C">:target</a>. We will style it using CSS3 and an icon font. The idea behind this demo is to show the user the login form and provide a link to &#8220;switch&#8221; to the registration form. </p>
<p><em>Note that this is for demo purpose only, it will only work in browser supporting the :target pseudo class, and you should not use this code on a live website without providing solid fallback.</em></p>
<p>In the following, we will be going through Demo 1.</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The HTML</h3>
<p>In the  HTML, we will put both forms, hiding the second one with CSS. Here is the code, I&#8217;ll explain some of the interesting parts later.</p>
<pre class="brush:xml">
&lt;div id="container_demo" &gt;
	&lt;!-- hidden anchor to stop jump http://www.css3create.com/Astuce-Empecher-le-scroll-avec-l-utilisation-de-target#wrap4  --&gt;
	&lt;a class="hiddenanchor" id="toregister"&gt;&lt;/a&gt;
	&lt;a class="hiddenanchor" id="tologin"&gt;&lt;/a&gt;
	&lt;div id="wrapper"&gt;
		&lt;div id="login" class="animate form"&gt;
			&lt;form  action="mysuperscript.php" autocomplete="on"&gt;
				&lt;h1&gt;Log in&lt;/h1&gt;
				&lt;p&gt;
					&lt;label for="username" class="uname" data-icon="u" &gt; Your email or username &lt;/label&gt;
					&lt;input id="username" name="username" required="required" type="text" placeholder="myusername or mymail@mail.com"/&gt;
				&lt;/p&gt;
				&lt;p&gt;
					&lt;label for="password" class="youpasswd" data-icon="p"&gt; Your password &lt;/label&gt;
					&lt;input id="password" name="password" required="required" type="password" placeholder="eg. X8df!90EO" /&gt;
				&lt;/p&gt;
				&lt;p class="keeplogin"&gt;
					&lt;input type="checkbox" name="loginkeeping" id="loginkeeping" value="loginkeeping" /&gt;
					&lt;label for="loginkeeping"&gt;Keep me logged in&lt;/label&gt;
				&lt;/p&gt;
				&lt;p class="login button"&gt;
					&lt;input type="submit" value="Login" /&gt;
				&lt;/p&gt;
				&lt;p class="change_link"&gt;
					Not a member yet ?
					&lt;a href="#toregister" class="to_register"&gt;Join us&lt;/a&gt;
				&lt;/p&gt;
			&lt;/form&gt;
		&lt;/div&gt;

		&lt;div id="register" class="animate form"&gt;
			&lt;form  action="mysuperscript.php" autocomplete="on"&gt;
				&lt;h1&gt; Sign up &lt;/h1&gt;
				&lt;p&gt;
					&lt;label for="usernamesignup" class="uname" data-icon="u"&gt;Your username&lt;/label&gt;
					&lt;input id="usernamesignup" name="usernamesignup" required="required" type="text" placeholder="mysuperusername690" /&gt;
				&lt;/p&gt;
				&lt;p&gt;
					&lt;label for="emailsignup" class="youmail" data-icon="e" &gt; Your email&lt;/label&gt;
					&lt;input id="emailsignup" name="emailsignup" required="required" type="email" placeholder="mysupermail@mail.com"/&gt;
				&lt;/p&gt;
				&lt;p&gt;
					&lt;label for="passwordsignup" class="youpasswd" data-icon="p"&gt;Your password &lt;/label&gt;
					&lt;input id="passwordsignup" name="passwordsignup" required="required" type="password" placeholder="eg. X8df!90EO"/&gt;
				&lt;/p&gt;
				&lt;p&gt;
					&lt;label for="passwordsignup_confirm" class="youpasswd" data-icon="p"&gt;Please confirm your password &lt;/label&gt;
					&lt;input id="passwordsignup_confirm" name="passwordsignup_confirm" required="required" type="password" placeholder="eg. X8df!90EO"/&gt;
				&lt;/p&gt;
				&lt;p class="signin button"&gt;
					&lt;input type="submit" value="Sign up"/&gt;
				&lt;/p&gt;
				&lt;p class="change_link"&gt;
					Already a member ?
					&lt;a href="#tologin" class="to_register"&gt; Go and log in &lt;/a&gt;
				&lt;/p&gt;
			&lt;/form&gt;
		&lt;/div&gt;

	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>We&#8217;ve added some HTML5 goodness here and used some of the new inputs. The input <em>type=password</em> automatically hides what the user is typing and replaces it with dots (depending on browser). The input <em>type=email</em> enables the browser to check if what the user entered has the format of a valid email address. We&#8217;ve also used the <em>require=required</em> attribute; browsers that support this attribute will not let the user submit the form until this field is filled, no JavaScript required.<br />
The <em>autocomplete=on</em> attribute will prefill values based on earlier user input. We also used some nice placeholders for the inputs that will show some guiding value when the input is not filled.</p>
<p>Now the two tricky parts. You might have noticed the two &lt;a href&gt; links at the top of the form. This is a <a href="http://www.css3create.com/Astuce-Empecher-le-scroll-avec-l-utilisation-de-target#wrap4" title="French : CSS3 trick to prevent jumping">little trick</a> that will make our form behave nicely when playing with anchors, so that it won&#8217;t &#8220;jump&#8221; on long pages when we click on the switching link and trigger the :target pseudo-class. </p>
<p>The second little trick is related to the use of the icon font. We will be using a <a href="http://html5doctor.com/html5-custom-data-attributes/" title="HTML5 Custom Data Attributes">data-attribute</a> to display the icons. By setting <em>data-icon=&#8221;icon_character&#8221;</em> with the according character in the HTML we will just need one CSS attribute selector to style all the icons. Read more about this technique on <a href="http://24ways.org/2011/displaying-icons-with-fonts-and-data-attributes" title="Displaying Icons with Fonts and Data- Attributes">24 Ways: Displaying Icons with Fonts and Data- Attributes</a>.</p>
<h3>The CSS</h3>
<p>For the clearness of the code in this tutorial, I will omit all the vendor prefixes, but you will, of course, find them in the files. Once again, I&#8217;m using some pretty advanced CSS3 tricks that might not work in all browsers. Let&#8217;s get started.</p>
<h4>Styling both forms using CSS3</h4>
<p>First, let&#8217;s give our two forms some general styling for the container.</p>
<pre class="brush:css">
#subscribe,
#login{
	position: absolute;
	top: 0px;
	width: 88%;
	padding: 18px 6% 60px 6%;
	margin: 0 0 35px 0;
	background: rgb(247, 247, 247);
	border: 1px solid rgba(147, 184, 189,0.8);
	box-shadow:
		0pt 2px 5px rgba(105, 108, 109,  0.7),
		0px 0px 8px 5px rgba(208, 223, 226, 0.4) inset;
	border-radius: 5px;
}
#login{
	z-index: 22;
}
</pre>
<p>We&#8217;ve added a nice box shadow that&#8217;s made of two shadows: an inset one to create the inner blue glow, and an outside shadow. We&#8217;ll explain the z-index in a bit.</p>
<p>In the following we will style the header with some background clipping:</p>
<pre class="brush:css">
/**** general text styling ****/
#wrapper h1{
	font-size: 48px;
	color: rgb(6, 106, 117);
	padding: 2px 0 10px 0;
	font-family: 'FranchiseRegular','Arial Narrow',Arial,sans-serif;
	font-weight: bold;
	text-align: center;
	padding-bottom: 30px;
}

/** For the moment only webkit supports the background-clip:text; */
#wrapper h1{
	background:
	-webkit-repeating-linear-gradient(-45deg,
		rgb(18, 83, 93) ,
		rgb(18, 83, 93) 20px,
		rgb(64, 111, 118) 20px,
		rgb(64, 111, 118) 40px,
		rgb(18, 83, 93) 40px);
	-webkit-text-fill-color: transparent;
	-webkit-background-clip: text;
}

#wrapper h1:after{
	content:' ';
	display:block;
	width:100%;
	height:2px;
	margin-top:10px;
	background:
		linear-gradient(left,
			rgba(147,184,189,0) 0%,
			rgba(147,184,189,0.8) 20%,
			rgba(147,184,189,1) 53%,
			rgba(147,184,189,0.8) 79%,
			rgba(147,184,189,0) 100%);
}
</pre>
<p>Note that at this moment only webkit browsers support <em>background-clip: text</em>, so we will create a stripped background only for webkit here, and clip it to the text to add the stripes to the H1 title. Since the <em>background-clip: text</em> property currently only works in Webkit browsers, I decided to go only with the webkit prefix. That&#8217;s the reason why I split the CSS declaration into two parts, and use a webkit prefixed gradient only. Only using the –webkit- prefix is bad practice, it&#8217;s only for demo purpose, and  you should never do this on real a website! That&#8217;s also where the <em>-webkit-text-fill-color:  transparent</em> comes in handy: it enables us to only have a transparent background on the webkit browsers, all the other ones will ignore it and give us the provided text color fallback.</p>
<p>We also created a fading line under the title with the help of the :after pseudo-class. We use a 2px height gradient and fade the background to 0 opacity at both ends.</p>
<p>Now let&#8217;s style our inputs and give them a nicer look.</p>
<pre class="brush:css">
/**** advanced input styling ****/
/* placeholder */
::-webkit-input-placeholder  {
	color: rgb(190, 188, 188);
	font-style: italic;
}
input:-moz-placeholder,
textarea:-moz-placeholder{
	color: rgb(190, 188, 188);
	font-style: italic;
}
input {
  outline: none;
}
</pre>
<p>First we style the inputs, and remove the outline. But be careful here; the outline helps the user know which input is focused, so if you remove it, you should provide some :active and :focus states for the inputs.</p>
<pre class="brush:css">
/* all the input except submit and checkbox */
#wrapper input:not([type="checkbox"]){
	width: 92%;
	margin-top: 4px;
	padding: 10px 5px 10px 32px;
	border: 1px solid rgb(178, 178, 178);
	box-sizing : content-box;
	border-radius: 3px;
	box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.6) inset;
	transition: all 0.2s linear;
}
#wrapper input:not([type="checkbox"]):active,
#wrapper input:not([type="checkbox"]):focus{
	border: 1px solid rgba(91, 90, 90, 0.7);
	background: rgba(238, 236, 240, 0.2);
	box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.9) inset;
}
</pre>
<p>Here we used the :not pseudo class, to style all inputs, except the checkbox. I provided a :focus and :active state, since I decided to remove the outline.</p>
<p>And now the fun part: the icon font. Since we can&#8217;t use :before and :after pseudo classes on inputs, we&#8217;ll have to cheat a little bit: we&#8217;ll add the icon to the label, and then place it in the input. I&#8217;m using the  <a href="http://nodeca.github.com/fontomas/" title="The fontomas font icon library">fontomas library</a> which puts together some nice icons. You can rearrange them to set the icon to a specific letter.  Remember the  <em>data-icon</em> attribute? It&#8217;s where you should put the letter. I used <em>data-icon=&#8217;u&#8217;</em> for user, &#8216;e&#8217; for email, &#8216;p&#8217; for password.  Once I  chose the letters, I downloaded the font, and used the <a href="http://www.fontsquirrel.com/fontface/generator" title="fontsquirrel generator for font-face">fontsquirrel font generator</a> to transform it into a @font-face compatible format. </p>
<pre class="brush:css">
@font-face {
    font-family: 'FontomasCustomRegular';
    src: url('fonts/fontomas-webfont.eot');
    src: url('fonts/fontomas-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/fontomas-webfont.woff') format('woff'),
         url('fonts/fontomas-webfont.ttf') format('truetype'),
         url('fonts/fontomas-webfont.svg#FontomasCustomRegular') format('svg');
    font-weight: normal;
    font-style: normal;
}

/** the magic icon trick ! **/
[data-icon]:after {
    content: attr(data-icon);
    font-family: 'FontomasCustomRegular';
    color: rgb(106, 159, 171);
    position: absolute;
    left: 10px;
    top: 35px;
	width: 30px;
}
</pre>
<p>Yeah, that&#8217;s it folks, you don&#8217;t need to have a class for each icon. We used <em>content: attr(data-icon)</em> to retrieve the letter from the data-icon attribute, so we only have to declare the font, choose a nice color and position it. </p>
<p>Now let&#8217;s style the submit button for both forms.</p>
<pre class="brush:css">
/*styling both submit buttons */
#wrapper p.button input{
	width: 30%;
	cursor: pointer;
	background: rgb(61, 157, 179);
	padding: 8px 5px;
	font-family: 'BebasNeueRegular','Arial Narrow',Arial,sans-serif;
	color: #fff;
	font-size: 24px;
	border: 1px solid rgb(28, 108, 122);
	margin-bottom: 10px;
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
	border-radius: 3px;
	box-shadow:
		0px 1px 6px 4px rgba(0, 0, 0, 0.07) inset,
		0px 0px 0px 3px rgb(254, 254, 254),
		0px 5px 3px 3px rgb(210, 210, 210);
	transition: all 0.2s linear;
}
#wrapper p.button input:hover{
	background: rgb(74, 179, 198);
}
#wrapper p.button input:active,
#wrapper p.button input:focus{
	background: rgb(40, 137, 154);
	position: relative;
	top: 1px;
	border: 1px solid rgb(12, 76, 87);
	box-shadow: 0px 1px 6px 4px rgba(0, 0, 0, 0.2) inset;
}
p.login.button,
p.signin.button{
	text-align: right;
	margin: 5px 0;
}
</pre>
<p>The trick here is to use the box-shadow in order to create some extra borders. You can only use one border, but as many box-shadows as you want. We will use the length value to create a &#8220;fake&#8221; second white border, 3px wide, with no blur.</p>
<p>Then we&#8217;ll style the checkbox, nothing very special here:</p>
<pre class="brush:css">
/* styling the checkbox "keep me logged in"*/
.keeplogin{
	margin-top: -5px;
}
.keeplogin input,
.keeplogin label{
	display: inline-block;
	font-size: 12px;
	font-style: italic;
}
.keeplogin input#loginkeeping{
	margin-right: 5px;
}
.keeplogin label{
	width: 80%;
}
</pre>
<p>We will style the bottom of the form using repeating linear gradients to create a striped background.</p>
<pre class="brush:css">
p.change_link{
	position: absolute;
	color: rgb(127, 124, 124);
	left: 0px;
	height: 20px;
	width: 440px;
	padding: 17px 30px 20px 30px;
	font-size: 16px	;
	text-align: right;
	border-top: 1px solid rgb(219, 229, 232);
	border-radius: 0 0  5px 5px;
	background: rgb(225, 234, 235);
	background: repeating-linear-gradient(-45deg,
	rgb(247, 247, 247) ,
	rgb(247, 247, 247) 15px,
	rgb(225, 234, 235) 15px,
	rgb(225, 234, 235) 30px,
	rgb(247, 247, 247) 30px
	);
}
#wrapper p.change_link a {
	display: inline-block;
	font-weight: bold;
	background: rgb(247, 248, 241);
	padding: 2px 6px;
	color: rgb(29, 162, 193);
	margin-left: 10px;
	text-decoration: none;
	border-radius: 4px;
	border: 1px solid rgb(203, 213, 214);
	transition: all 0.4s  linear;
}
#wrapper p.change_link a:hover {
	color: rgb(57, 191, 215);
	background: rgb(247, 247, 247);
	border: 1px solid rgb(74, 179, 198);
}
#wrapper p.change_link a:active{
	position: relative;
	top: 1px;
}
</pre>
<p>Now you&#8217;ll notice that we&#8217;ve got two nice forms, but we really want only one to show at a time. So now is time for some animations!!</p>
<h4>Creating the switching animation</h4>
<p>The first thing to do is to hide the second form by setting the opacity to 0:</p>
<pre class="brush:css">
#register{
	z-index: 21;
	opacity: 0;
}
</pre>
<p>Remember that our login form had a z-index of 22? We will give the second form a z-index of 21, to put it &#8220;under&#8221; the login form.</p>
<p>And now the really good part: switching the forms using the :target pseudo class. What you really have to understand about :target, is that we will use anchors to make the transition. The normal behavior of an anchor link, is to jump to the target in the page. But we don&#8217;t want to jump anywhere, we only want to switch the forms. And here comes our trick using the two links at the top of the page. Instead of directly linking to the second form, and risking getting a &#8220;jumping&#8221; effect, we actually put the two links at the top of the page and give them <em>display: none</em>. This will avoid any page jump. Credit where credit&#8217;s due: I found this trick on <a href="http://www.css3create.com/Astuce-Empecher-le-scroll-avec-l-utilisation-de-target#wrap4">CSS3 create</a> (in French).</p>
<pre class="brush:css">
#toregister:target ~ #wrapper #register,
#tologin:target ~ #wrapper #login{
	z-index: 22;
	animation-name: fadeInLeft;
	animation-delay: .1s;
}
</pre>
<p>So this is what happens: when we click on the <em>Join us</em> button, we trigger the #toregister. We then do the animation, by using the sibling selector ~ to find our #register element. We use an animation called <em>fadeInLeft</em>. Since we &#8220;hide&#8221; the form using zero opacity, we will use an animation that fades in, to make it appear. We&#8217;ve also changed the z-index, to make it appear on top of the other form.<br />
The same happens for the other form.</p>
<p>And here is the code for the animation. We are using the <a href="http://daneden.me/animate/" title="Animate.css">CSS3 animation framework</a> from Dan Eden and adapted it for this tutorial.</p>
<pre class="brush:css">
.animate{
	animation-duration: 0.5s;
	animation-timing-function: ease;
	animation-fill-mode: both;
}
@keyframes fadeInLeft {
	0% {
		opacity: 0;
		transform: translateX(-20px);
	}

	100% {
		opacity: 1;
		transform: translateX(0);
	}
}
</pre>
<p>The form that is &#8220;disappearing&#8221; will have another animation which will make it fade out to the left:</p>
<pre class="brush:css">
#toregister:target ~ #wrapper #login,
#tologin:target ~ #wrapper #register{
	animation-name: fadeOutLeftBig;
}

@keyframes fadeOutLeft {
	0% {
		opacity: 1;
		transform: translateX(0);
	}

	100% {
		opacity: 0;
		transform: translateX(-20px);
	}
}
</pre>
<p>You can now use other animations from Dan Eden&#8217;s animate.css: just adjust your .animate class and replace the animation names. You will also find some custom animations at the end of the animate-custom.css file.</p>
<p>Well, that&#8217;s it folks. I hope you enjoyed the tutorial!</p>
<p><strong>Please note, that in some browsers <em>background-clip: text</em> is not supported. In Internet Explorer 9 the transitions and animations don&#8217;t work, so there will be no fancy form switching. In Internet Explorer 8 and below the :target pseudo-class is not supported, so it won&#8217;t work at all (you&#8217;ll just see the login form).</strong></p>
<h3>Demos</h3>
<ol>
<li><strong><a href="http://tympanus.net/Tutorials/LoginRegistrationForm/index.html">Slide to left and fade</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/LoginRegistrationForm/index2.html">Slide to the left</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/LoginRegistrationForm/index3.html">Scale up/down</a></strong></li>
</ol>
<p><a class="demo" href="http://tympanus.net/Tutorials/LoginRegistrationForm/">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/LoginRegistrationForm/LoginRegistrationForm.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/03/27/login-and-registration-form-with-html5-and-css3/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>Responsive Content Navigator with CSS3</title>
		<link>http://tympanus.net/codrops/2012/03/23/responsive-content-navigator-with-css3/</link>
		<comments>http://tympanus.net/codrops/2012/03/23/responsive-content-navigator-with-css3/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 14:29:43 +0000</pubDate>
		<dc:creator>Mary Lou</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[responsive]]></category>
		<category><![CDATA[target]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://tympanus.net/codrops/?p=8012</guid>
		<description><![CDATA[Today we want to show you how to create a responsive, css-only content navigator.]]></description>
			<content:encoded><![CDATA[<p><a href="http://tympanus.net/Tutorials/CSS3ContentNavigator/index.html#slide-main"><br />
<img src="http://tympanus.net/codrops/wp-content/uploads/2012/03/ContentNavigator1.jpg" alt="ContentNavigator" title="" width="580" height="315" class="alignnone size-full wp-image-8050" /><br />
</a></p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3ContentNavigator/index.html#slide-main">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3ContentNavigator/CSS3ContentNavigator.zip">Download source</a></p>
<p>Today we&#8217;ll show you how to create a content navigator with CSS only. The idea is to have several slides or content layers that we&#8217;ll show or hide using the :target pseudo-class. With CSS transitions we can make the slides appear in a fancy way. We&#8217;ll also make the whole thing responsive.</p>
<p>The images used in the demo are by super-talented <a href="camerakarrie.blogspot.com">Karrie Nodalo</a>. Check out <a href="http://www.flickr.com/people/karrienodalo/">her Flickr photostream</a>. The images are licensed under the <a href="http://creativecommons.org/licenses/by/2.0/">Creative Commons Attribution 2.0 Generic License</a>.</p>
<p><strong>Please note: the result of this tutorial will only work as intended in browsers that support the CSS properties in use.</strong></p>
<p>In the following we&#8217;ll be going through <strong><a href="http://tympanus.net/Tutorials/CSS3ContentNavigator/index3.html#slide-main">demo 3</a></strong>.<br />
Let&#8217;s do it!</p>
<div id="bsap_1266918" class="bsarocks bsap_af25dfd2f1908889af7a1aa5f4dcbd9e"></div><div style="clear:both;"></div>
<h3>The Markup</h3>
<p>For each of the different slides that will either contain a set of links, sub-slides or some content, we will have a division with the class <strong>cn-slide</strong>. For the sub-slide that will contain two link boxes in a row we&#8217;ll add another class called <strong>cn-slide-sub</strong>. The content slides will simply have the general class <strong>cn-slide</strong> like all the others.</p>
<p>There will be one main slide that will have links to three sub-slides. Then, each of the sub-slides will have four links, each one pointing to a content slide. So, all together we have one main slide, three sub-slides and twelve content slides:</p>
<pre class="brush:xml">
&lt;section class="cn-container"&gt;

	&lt;div class="cn-slide" id="slide-main"&gt;
		&lt;h2&gt;Explore this&lt;/h2&gt;
		&lt;nav&gt;
			&lt;a href="#slide-1"&gt;Philosphy&lt;/a&gt;
			&lt;a href="#slide-2"&gt;Science&lt;/a&gt;
			&lt;a href="#slide-3"&gt;Literature&lt;/a&gt;
		&lt;/nav&gt;
	&lt;/div&gt;

	&lt;!-- Slide 1 and sub-slides --&gt;
	&lt;div class="cn-slide ts-slide-sub" id="slide-1"&gt;
		&lt;h2&gt;Philosophy&lt;/h2&gt;
		&lt;a href="#slide-main" class="cn-back"&gt;Back&lt;/a&gt;
		&lt;nav&gt;
			&lt;a href="#slide-1-1"&gt;Epistemology&lt;/a&gt;
			&lt;a href="#slide-1-2"&gt;Metaphysics&lt;/a&gt;
			&lt;a href="#slide-1-3"&gt;Aesthetics&lt;/a&gt;
			&lt;a href="#slide-1-4"&gt;Ethics&lt;/a&gt;
		&lt;/nav&gt;
	&lt;/div&gt;

	&lt;div class="cn-slide" id="slide-1-1"&gt;
		&lt;h2&gt;Epistemology&lt;/h2&gt;
		&lt;a href="#slide-1" class="cn-back"&gt;Back&lt;/a&gt;
		&lt;div class="cn-content"&gt;
			&lt;p&gt;Some text&lt;/p&gt;
		&lt;/div&gt;
	&lt;/div&gt;

	&lt;div class="cn-slide" id="slide-1-2"&gt;
		&lt;h2&gt;Metaphysics&lt;/h2&gt;
		&lt;!-- ... --&gt;
	&lt;/div&gt;

	&lt;div class="cn-slide" id="slide-1-3"&gt;
		&lt;!-- ... --&gt;
	&lt;/div&gt;

	&lt;div class="cn-slide" id="slide-1-4"&gt;
		&lt;!-- ... --&gt;
	&lt;/div&gt;

	&lt;!-- Slide 2 and Sub-slides --&gt;
	&lt;!-- ... --&gt;

&lt;/section&gt;
</pre>
<p>The sub-slides and the slides with content will have a link back to their previous &#8220;layer&#8221;. So, all the content slides of the &#8220;Philosophy&#8221; part will link back to &#8220;slide-1&#8243; which is the sub-slide of &#8220;Philosophy&#8221;.</p>
<p>Let&#8217;s take a look at the CSS!</p>
<h3>The CSS</h3>
<p>The main container will have a min-width and a max-width which will allow us using a percentage for the width but guarantee that it will not become too big or too small:</p>
<pre class="brush:css">
.cn-container{
	width: 60%;
	min-width: 300px;
	max-width: 820px;
	margin: 10px auto 0 auto;
	text-align: left;
	position: relative;
}
</pre>
<p>The main headline will be placed absolutely and we will make it fade in and scale up when &#8220;opening&#8221; a slide. The transition will have a delay because we want it to appear after all the link boxes:</p>
<pre class="brush:css">
.cn-container h2{
	font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif;
	color: #fff;
	position: absolute;
	z-index: 10000;
	text-shadow:
		0 0 1px rgba(255,255,255,0.8),
		1px 1px 1px rgba(0,0,0,0.2);
	font-size: 80px;
	line-height: 80px;
	top: 0px;
	right: 0px;
	white-space: nowrap;
	opacity: 0;
	transform: scale(0);
	transition: all 0.5s linear 0.7s;
}
.cn-container .cn-slide:target h2{
	opacity: 1;
	transform: scale(1);
}
</pre>
<p>The slides will also be placed absolutely. We&#8217;ll set the initial opacity of the slides to 0 and show it once we know that it&#8217;s the target:</p>
<pre class="brush:css">
.cn-slide{
	text-align: center;
	position: absolute;
	left: 0px;
	padding-top: 80px;
	margin: 0 5%;
	width: 90%;
	opacity: 0;
}
.cn-slide:target{
	opacity: 1;
	z-index: 1000;
}
</pre>
<p>Note that in some other demos we are using the transitions on the slides. Here we will use sequential transitions on the link elements.</p>
<p>Now, let&#8217;s take a look at the link elements. They will all have a single background image which we will later define for each element. By default, we&#8217;ll give 1.jpg as the background image. Initially, the opacity and scale will be 0. We add a transition for the two properties and also for the box-shadow which we need when we hover the element:</p>
<pre class="brush:css">
.cn-slide nav a{
	text-align: left;
	display: block;
	font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif;
	border: 8px solid #fff;
	padding: 2%;
	font-size: 66px;
	letter-spacing: 7px;
	text-shadow: 0px 5px 0px rgba(182,105,135,0.4);
	color: #fff;
	line-height: 66px;
	outline: none;
	margin: 0 0 10px 0;
	box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
	background: #fff url(../images/1.jpg) no-repeat center center;
	background-size: 100%;
	background-clip: padding-box;
	opacity: 0;
	transform: scale(0);
	transition:
		opacity 0.4s linear,
		transform 0.4s linear,
		box-shadow 0.3s ease-in-out;
}
.cn-slide nav a:hover{
	box-shadow: 1px 2px 4px rgba(0,0,0,0.2);
}
</pre>
<p>The target slide&#8217;s link elements will fade in and scale up to 1:</p>
<pre class="brush:css">
.cn-slide:target nav a{
	opacity: 1;
	transform: scale(1);
}
</pre>
<p>Let&#8217;s define a transition delay for the elements, so that they appear one after the other:</p>
<pre class="brush:css">
.cn-slide nav a:nth-child(2){
	transition-delay: 0.3s, 0.3s, 0s;
}
.cn-slide nav a:nth-child(3){
	transition-delay: 0.6s, 0.6s, 0s;
}
.cn-slide nav a:nth-child(4){
	transition-delay: 0.9s, 0.9s,0s;
}
</pre>
<p>As you can see, the last delay will be of 0 seconds since this is the delay for the box-shadow transition, the one that get&#8217;s applied on hover. </p>
<p>The link elements in the sub-slides will have a width of 42% because we want two to fit into a row:</p>
<pre class="brush:css">
.cn-slide-sub nav a{
	width: 42%;
	display: inline-block;
	font-size: 40px;
}
</pre>
<p>To create a little gap between the elements, we&#8217;ll give a right margin to the odd children:</p>
<pre class="brush:css">
.cn-slide-sub nav a:nth-child(odd){
	margin-right: 5px;
}
</pre>
<p>The slides with a content area are the &#8220;final&#8221; ones and we&#8217;ll also add a transition to that division:</p>
<pre class="brush:css">
.cn-content{
	background: #80B8CE url(../images/1.jpg) no-repeat center center;
	background-size: cover;
	text-align: left;
	padding: 20px 20px 5px;
	box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
	border: 8px solid #fff;
	margin-top: 5px;
	cursor: pointer;
	opacity: 0;
	transform: scale(0);
	transition: all 0.6s linear;
}
.cn-slide:target .cn-content{
	opacity: 1;
	transform: scale(1);
}
</pre>
<p>Each content area will, just like their corresponding link elements, have a background image that we will define later.</p>
<p>The paragraphs will also have a transition which will be applied when we click on the content. With the :active pseudo-class we can let the user view the background of the content div by clicking on it (and keeping it clicked):</p>
<pre class="brush:css">
.cn-content p{
	line-height: 24px;
	text-shadow: 1px 1px 1px rgba(255,255,255,0.9);
	color: rgba(103,59,77,0.9);
	padding: 15px 20px;
	margin-bottom: 10px;
	background: rgba(255,255,255,0.96);
	font-style: italic;
	border-top: 7px solid rgba(103,59,77,0.6);
	user-select: none;
	transform: scale(1);
	transition: all 0.3s linear;
}
.cn-content:active p{
	transform: scale(0);
}
</pre>
<p>The back arrow will be sliding in from the left. We set it to -100px initially and to 3px when a slide is the target:</p>
<pre class="brush:css">
.cn-back{
	outline: none;
	text-indent: -9000px;
	width: 49px;
	height: 42px;
	background: transparent url(../images/arrow.png) no-repeat center center;
	position: absolute;
	top: 22px;
	left: -100px;
	cursor: pointer;
	opacity: 0;
	transition: all 0.4s ease-in-out 1s;
}
.cn-slide:target .cn-back{
	left: 3px;
	opacity: 1;
}
</pre>
<p>Now, let&#8217;s define the background images for each link element. With the very helpful attribute selector, we can specify which element will have what background image. We will look at what the href value is and define the image:</p>
<pre class="brush:css">
/* Main Items */
.cn-slide nav a[href="#slide-1"]{
	background-image: url(../images/1.jpg);
}
.cn-slide nav a[href="#slide-2"]{
	background-image: url(../images/2.jpg);
}
.cn-slide nav a[href="#slide-3"]{
	background-image: url(../images/3.jpg);
}

/* Items and sub-items of slide 1*/
.cn-slide nav a[href="#slide-1-1"],
#slide-1-1 .cn-content {
	background-image: url(../images/4.jpg);
}
.cn-slide nav a[href="#slide-1-2"],
#slide-1-2 .cn-content {
	background-image: url(../images/5.jpg);
}
.cn-slide nav a[href="#slide-1-3"],
#slide-1-3 .cn-content {
	background-image: url(../images/6.jpg);
}
.cn-slide nav a[href="#slide-1-4"],
#slide-1-4 .cn-content {
	background-image: url(../images/7.jpg);
}

/* Items and sub-items of slide 2 ... */
/* ... */

/* Items and sub-items of slide 3 ... */
/* ... */
</pre>
<p>Finally, we will define some media queries to fix the layout when we view this on a smaller screen. You can of course define the standard media queries for common devices but here we will simply check when our liquid layout breaks and define a rule for that &#8220;breaking-point&#8221;. In our case, that&#8217;s 1060 pixel and 900 pixel. We will adjust the font size and allow the sub-slides to have one item in a row:</p>
<pre class="brush:css">
@media screen and (max-width: 1060px){
	.cn-slide-sub nav a{
		font-size: 28px;
	}
}
@media screen and (max-width: 900px){
	.cn-container h2{
		font-size: 48px;
		line-height: 95px;
	}
	.cn-slide nav a{
		font-size: 38px;
	}
	.cn-slide-sub nav a{
		width: auto;
		font-size: 36px;
		display: block;
	}
	.cn-slide-sub nav a:nth-child(odd){
		margin-right: 0px;
	}
}
</pre>
<h3>Demos</h3>
<ol>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3ContentNavigator/index.html#slide-main">Demo 1: Slide from left</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3ContentNavigator/index2.html#slide-main">Demo 2: Fade in sequentially</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3ContentNavigator/index3.html#slide-main">Demo 3: Scale up sequentially</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3ContentNavigator/index4.html#slide-main">Demo 4: Slide from top</a></strong></li>
<li><strong><a href="http://tympanus.net/Tutorials/CSS3ContentNavigator/index5.html#slide-main">Demo 5: Rotate sequentially</a></strong></li>
</ol>
<p>And that&#8217;s it! I hope you enjoyed this tutorial and find it useful!<br />
There are many possibilities for the transitions, just experiment!</p>
<p><a class="demo" href="http://tympanus.net/Tutorials/CSS3ContentNavigator/index.html#slide-main">View demo</a> <a class="download" href="http://tympanus.net/Tutorials/CSS3ContentNavigator/CSS3ContentNavigator.zip">Download source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tympanus.net/codrops/2012/03/23/responsive-content-navigator-with-css3/feed/</wfw:commentRss>
		<slash:comments>46</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  tympanus.net/codrops/category/tutorials/feed/ ) in 0.32670 seconds, on May 23rd, 2012 at 1:19 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 23rd, 2012 at 2:19 pm UTC -->
