<?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>Design Shack &#187; CSS</title>
	<atom:link href="http://designshack.net/category/articles/css/feed" rel="self" type="application/rss+xml" />
	<link>http://designshack.net</link>
	<description>Inspiration, CSS Gallery &#38; Community News</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Three Super Easy Ways to Pull Off a Masonry Layout</title>
		<link>http://designshack.net/articles/css/masonry/</link>
		<comments>http://designshack.net/articles/css/masonry/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 06:00:30 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[masonry]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=29284</guid>
		<description><![CDATA[Masonry style layouts push the boundaries of creative layout techniques. I personally love how capable they prove to be at maximizing the efficiency of galleries containing items with varying heights. Every bit of screen space is used and the result can be downright mesmerizing. Today we&#8217;re going to dive into the concept, ideas and popular [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/masonry-layout-0.jpg" alt="screenshot" width="510"/></div>
<p>Masonry style layouts push the boundaries of creative layout techniques. I personally love how capable they prove to be at maximizing the efficiency of galleries containing  items with varying heights. Every bit of screen space is used and the result can be downright mesmerizing.</p>
<p>Today we&#8217;re going to dive into the concept, ideas and popular techniques that are currently prevalent in masonry style layouts. We&#8217;ll learn three different methods for pulling off a masonry layout, discuss the ins and outs of each and make sure that the result is beautifully responsive and reflows based on browser width. </p>
<p><span id="more-29284"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>What Is a Masonry Layout?</h2>
<p>When you float objects in CSS, the browser arranges elements first horizontally then vertically. When we fill a container with a bunch of equally sized objects and float them left, we get a nice grid of images.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/masonry-layout-2.jpg" alt="screenshot" width="510"/></div>
<p>However, if the objects have variable heights, the results are much more difficult to predict. Instead of a nice tight grid, we get something that tends to be fairly scattered. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/masonry-layout-1.jpg" alt="screenshot" width="510"/></div>
<p>The obvious quandary here is how to pull off a nice tight grid that with items that have variable heights. It&#8217;s a pretty interesting topic and various developers have come up with several ways to go about it. Let&#8217;s take a look at three of the current best solutions. </p>
<p>To go one step further, we&#8217;re going to make sure that all three solutions are responsive, meaning the grid will reflow as the window size changes. </p>
<h2>jQuery Masonry</h2>
<div class="tutorialimage"><a href="http://masonry.desandro.com/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/masonry-layout-6.jpg" alt="screenshot" width="510"/></a></div>
<p><a href="http://masonry.desandro.com/index.html">jQuery Masonry</a> is the most popular solution to pull off this type of layout. It utilizes some pretty fancy JavaScript to reflow a series of divs. </p>
<p>Putting Masonry into practice is pretty easy, all you need is a container that holds a series of divs that you want to arrange masonry style. You can place anything you want inside the divs, in this case I threw in some placeholder images.</p>
<p>Once you have that in order, toss in jQuery and jQuery Masonry. Then you need to create a simple function that identifies your container and targets the class that we used for our Masonry images divs. Here&#8217;s a basic example:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;masonryImage&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/200/food/1&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;masonryImage&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/150/food/10&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;masonryImage&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/250/food/3&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
	. . .
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery-1.7.1.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.masonry.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
  $(function(){
&nbsp;
    var $container = $('#container');
&nbsp;
    $container.imagesLoaded( function(){
      $container.masonry({
        itemSelector : '.masonryImage'
      });
    });
&nbsp;
  });
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<h3>CSS</h3>
<p>As long as we have a width set on our container div, the code above performs the magic we need it to and reflows the elements. If you set the div width to a percent, jQuery Masonry even automatically reflows the items as the page resizes.</p>
<p>Even though this is the case, things can get messy if you want to keep your container centered. I found it easier to apply a static width to my container, then use media queries to reflow the columns as the page size decreases past the container size. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1200px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*Media Queries*/</span>
<span style="color: #a1a100;">@media only screen and (max-width : 1199px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">1199px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1000px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #a1a100;">@media only screen and (max-width : 999px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">999px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">800px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #a1a100;">@media only screen and (max-width : 799px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">799px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">600px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #a1a100;">@media only screen and (max-width : 599px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">599px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #a1a100;">@media only screen and (max-width : 399px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">399px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>See It In Action</h3>
<p>This gives us a nice tight image gallery that perfectly responds to various browser window sizes. I&#8217;ve taken all the spacing out to illustrate just how tight you can get your images, but feel free to build in some margins so your images are spaced out a bit more. </p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/masonry/demos/masonry.html">Click here</a> to launch demo</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/masonry-layout-3.jpg" alt="screenshot" width="510"/></div>
<h2>Wookmark</h2>
<div class="tutorialimage"><a href="http://www.wookmark.com/jquery-plugin"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/masonry-layout-7.jpg" alt="screenshot" width="510"/></a></div>
<p>Another popular JavaScript solution for achieving the same type of layout is <a href="http://www.wookmark.com/jquery-plugin">Wookmark.js</a>, which is the driving plugin behind the Pinterest-like <a href="http://www.wookmark.com/">Wookmark.com</a>.</p>
<p>Wookmark.js is in my opinion a little trickier to implement than jQuery Masonry because of the lack of documentation, but it&#8217;s still pretty basic stuff. All we need to do to start is toss a bunch of images into an unordered list. The catch with this plugin is that we have to declare inline height values for each of the images.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myContent&quot;</span>&gt;</span> 			
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;height: 206px;&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/206/animals/1&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;height: 256px;&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/256/animals/2&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;height: 216px;&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/216/animals/3&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;height: 276px;&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/276/animals/4&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span> 
	. . .
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>Once you&#8217;ve got that set up, then you insert the JavaScript at the bottom of the body just like last time. Insert both jQuery and Wookmark.js, then set up the simple function below, which targets the list items in our #myContent unordered list.</p>
<p>I tossed in another simple function here which essentially reloads the script as the window changes size. This will ensure that the columns automatically reflow and provide that responsive functionality. This time around we&#8217;ll ditch the media queries and let the JavaScript handle all of the layout.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery-1.7.1.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.wookmark.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
   <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
		$('#myContent li').wookmark({offset: 2});
&nbsp;
		window.onresize = function(event) {
		    $('#myContent li').wookmark({offset: 2});
		}
   <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<h3>CSS</h3>
<p>The CSS for this version is super minimal. All we need to do is set our ul width with a percentage and use position:relative. Then we set a specific width for each list item. That&#8217;s it!</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#myContent</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">80%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#myContent</span> li <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>See It In Action</h3>
<p>Just like last time, the result is a tight grid of images. However, even though spacing options are adjustable with Wookmark.js, I couldn&#8217;t get it to work at zero so we have a little bit of spacing in between the images. </p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/masonry/demos/wookmark.html">Click here</a> to launch demo</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/masonry-layout-4.jpg" alt="screenshot" width="510"/></div>
<h2>Pure CSS</h2>
<p>The JavaScript solutions are probably the safest and most widely compatible ways to go about a masonry layout, but the CSS nerd in me knew there had to be a way to pull it off without JavaScript.</p>
<p>It turns out, it&#8217;s actually pretty easy using some fancy CSS3. This technique was pioneered by <a href="http://sickdesigner.com/index.php/2011/html-css/masonry-css-getting-awesome-with-css3/">Radu Chelariu at SickDesigner</a> and though it&#8217;s definitely not as powerful, flexible, or cross-browser-compatible as the previous options, it&#8217;s still extremely impressive given that it&#8217;s all CSS.</p>
<p>To start off, let&#8217;s use the same unordered list that we did last time (no inline styles necessary), thrown into a container div. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myContent&quot;</span>&gt;</span> 			
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/206/nature/1&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/256/nature/2&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/216/nature/3&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.co.uk/wp-content/uploads/http://lorempixum.com/200/276/nature/4&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		. . .
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<h3>CSS</h3>
<p>Here&#8217;s where the voodoo happens. To start, apply a width to the container and center it. Then use the new CSS columns functionality to lay out the content into six columns with zero gap. Finally, target the images directly and set the display to inline-block with a width of 100%. Inline-block allows us to flow elements inline without floats while maintaining block level functionality. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1200px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#myContent</span> <span style="color: #00AA00;">&#123;</span>
	-moz-column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">6</span><span style="color: #00AA00;">;</span>
	-moz-column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	-webkit-column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">6</span><span style="color: #00AA00;">;</span>
	-webkit-column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">6</span><span style="color: #00AA00;">;</span>
	column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1200px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#myContent</span> img<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> inline-<span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>That&#8217;s all we need for the masonry layout, but we still have the responsive bit to go. We&#8217;ll basically use the same trick that we used for the first layout, only this time we&#8217;ll change the column count and container width when the window size gets too narrow. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@media only screen and (max-width : 1199px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">1199px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #cc00cc;">#myContent</span> <span style="color: #00AA00;">&#123;</span>
		-moz-column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">5</span><span style="color: #00AA00;">;</span>
		-moz-column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		-webkit-column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">5</span><span style="color: #00AA00;">;</span>
		-webkit-column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">5</span><span style="color: #00AA00;">;</span>
		column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1000px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1000px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #a1a100;">@media only screen and (max-width : 999px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">999px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #cc00cc;">#myContent</span> <span style="color: #00AA00;">&#123;</span>
		-moz-column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">4</span><span style="color: #00AA00;">;</span>
		-moz-column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		-webkit-column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">4</span><span style="color: #00AA00;">;</span>
		-webkit-column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">4</span><span style="color: #00AA00;">;</span>
		column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">800px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">800px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #a1a100;">@media only screen and (max-width : 799px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">799px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #cc00cc;">#myContent</span> <span style="color: #00AA00;">&#123;</span>
		-moz-column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">3</span><span style="color: #00AA00;">;</span>
		-moz-column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		-webkit-column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">3</span><span style="color: #00AA00;">;</span>
		-webkit-column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">34</span><span style="color: #00AA00;">;</span>
		column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">600px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">600px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #a1a100;">@media only screen and (max-width : 599px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">599px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #cc00cc;">#myContent</span> <span style="color: #00AA00;">&#123;</span>
		-moz-column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span>
		-moz-column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		-webkit-column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span>
		-webkit-column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		column-count<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span>
		column-gap<span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">400px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Compatibility</h3>
<p>The big problem here is that IE doesn&#8217;t have support for CSS columns until IE10. This means that you&#8217;ll have to use jQuery Masonry as a backup for IE users if you want to implement this technique in a real world scenario. </p>
<h3>See It In Action</h3>
<p>Here&#8217;s our third and final masonry layout demo. At a glance, the effect is exactly like we saw with jQuery Masonry. Not bad for plain old CSS!</p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/masonry/demos/css.html">Click here</a> to launch demo</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/masonry-layout-5.jpg" alt="screenshot" width="510"/></div>
<h2>Conclusion</h2>
<p>In a <a href="http://designshack.net/articles/business-articles/addictive-ux-why-pinterest-is-so-dang-amazing/">recent article on Pinterest</a>, I discussed just how powerful masonry layouts can be from a UX perspective, especially when combined with infinite scrolling.</p>
<p>You can definitely expect this budding trend to increase in popularity and before you know it you&#8217;ll have clients asking for a layout like the one they see on Pinterest. When this happens, you&#8217;ll now be prepared with not one but three possible solutions!</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/masonry/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Convert a Pricing Table PSD to HTML and CSS</title>
		<link>http://designshack.net/articles/css/csspricingtables/</link>
		<comments>http://designshack.net/articles/css/csspricingtables/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 06:00:37 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[pricing table]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=29263</guid>
		<description><![CDATA[Today we&#8217;re going to grab some PSD pricing tables from Design Curate and try to convert them to pure CSS so you can easily drop them into your site. It&#8217;ll be a super basic but fun exercise in bringing a static design to the web and you&#8217;ll learn plenty of fun stuff along the way [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-0.jpg" alt="screenshot" width="510"/></div>
<p>Today we&#8217;re going to grab some PSD pricing tables from <a href="http://designcurate.com/resource/pricing-tables">Design Curate</a> and try to convert them to pure CSS so you can easily drop them into your site. </p>
<p>It&#8217;ll be a super basic but fun exercise in bringing a static design to the web and you&#8217;ll learn plenty of fun stuff along the way such as how to style hr tags a create a superscript effect.</p>
<p><span id="more-29263"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>Original Design</h2>
<p>The design of our pricing tables is super minimal. They&#8217;re basically just a rounded corner rectangle with some text and buttons. Download the original PSD <a href="http://designcurate.com/resource/pricing-tables">here</a> for a closer look (we&#8217;re scrapping the Best Value banner).</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-1.jpg" alt="screenshot" width="510"/></div>
<p>As you can see, the primary task here will merely be shuffling elements into place. The top bar may seem like it&#8217;ll be tricky, but in reality it&#8217;s a cinch. More interesting from my perspective is how to style that thin dividing line and pulling off a superscript in the text. </p>
<p>Also of interest is the fact that the center pricing table is a little larger than the others and overlaps them. This could mean styling two unique versions of the table, but we&#8217;ll use a nice little trick that takes all the effort out of this. Let&#8217;s jump in and get started.</p>
<h2>Basic Shape</h2>
<p>To begin, we&#8217;ll focus on creating one pricing table. Once we have that one built, we can expand it into three fairly easily. Our first step is to create the basic shape of a single table: a vertical rectangle with rounded corners.</p>
<p>We&#8217;ll start with a div that will hold all the code for one pricing table. Assign the class of &#8220;pricingtable&#8221; so that we can easily reuse this element again later. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pricingtable&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now let&#8217;s add some style. Our pricing tables will be white so I set a gray background color to help them stand out. Then I applied some sizing to our class, rounded the corners and added a shadow.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
body <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ededed</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.pricingtable</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">250px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">450px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
&nbsp;
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
     -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
          border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">9px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
     -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">9px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
          box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">9px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Progress Update</h3>
<p>This step should give you a simple white box. Make sure that your dimensions are correct and that your shadow and rounded corners are functioning properly. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-2.jpg" alt="screenshot" width="510"/></div>
<h2>Top Bar</h2>
<p>Now that we&#8217;ve got our basic shape in place, we&#8217;ll start at the top and work our way down. The first thing that we need is obviously that colored bar at the top that holds the name for each of our pricing plans: Basic, Pro and Premium. To pull this off, create another div with the class of &#8220;top&#8221;. Don&#8217;t worry, we&#8217;re not going div crazy, this will be the last one that we need for our base pricing table template.</p>
<p>Inside the div, place an h2 (we&#8217;ll use the h1 later) with the name of the pricing table. We could simply use this h2 without the div to create the top bar, but structuring it this way makes it easier to add a sub tag or other content here later. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pricingtable&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Basic<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>Turning that div into our top bar is pretty simple. To start, we give it a width of 250px, a height of 50px and sample the PSD to get a background color of #2F2E35. Then we apply the same border-radius that we used before (10px), only this time we apply it to only the top two corners, leaving the bottom corners square. </p>
<p>Next it&#8217;s time to target the h2 and give it some styling. I simply changed the color to white, aligned the text to the center and used some fancy font shorthand to set the weight, size, line-height and font-family for our headline. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">top</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">250px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#2F2E35</span><span style="color: #00AA00;">;</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
     -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
          border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
.<span style="color: #000000; font-weight: bold;">top</span> h2 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">300</span> <span style="color: #933;">30px</span>/<span style="color: #933;">50px</span> Helvetica<span style="color: #00AA00;">,</span> Verdana<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Progress Update</h3>
<p>Our plain white box is already starting to look like the pricing table we&#8217;re going for. Now we just fill in the center contents and we&#8217;ll be ready to go.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-3.jpg" alt="screenshot" width="510"/></div>
<h2>Features</h2>
<p>Moving down the table, next we find a list of features. Right away that sentence should give you a hint as to how we can mark this section up: with a list. The order isn&#8217;t anything specific here so we&#8217;ll use an unordered list.</p>
<p>Notice that in our original design, the first word of each feature is bolded. We&#8217;ll toss in some strong tags to help us pull this off in our design. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pricingtable&quot;</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Basic<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Full<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Support<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>25GB<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> of Storage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>5<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Domains<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>10<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Addresses<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>Styling up this list is quite easy. To start, we want to ditch the bullet points, so set the list-style-type to &#8220;none&#8221;. After that, I use the same font shorthand as above but this time with a different size and line-height.</p>
<p>Notice that the line-height is set without a unit of measure (2, not 2px). This is a simple multiplier that takes the font-size into account (18px * 2 = 36px line-height). You can read more about this technique <a href="http://meyerweb.com/eric/thoughts/2006/02/08/unitless-line-heights/">here</a>.</p>
<p>To finish off this block of styles, target those strong tags and be sure that they&#8217;re set to bold. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.pricingtable</span> ul <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">300</span> <span style="color: #933;">18px</span>/<span style="color: #cc66cc;">2</span> Helvetica<span style="color: #00AA00;">,</span> Verdana<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">45px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.pricingtable</span> ul strong <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Progress Update</h3>
<p>Our feature list is looking perfect! Those bolder styles really help you focus on the important pieces of information. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-4.jpg" alt="screenshot" width="510"/></div>
<h2>Dividing Line</h2>
<p>In the original design, there&#8217;s a subtle line that separates the feature list from the price. This can be accomplished with a simple horizontal rule tag:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pricingtable&quot;</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Basic<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Full<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Support<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>25GB<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> of Storage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>5<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Domains<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>10<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Addresses<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">hr</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>The default styling for the horizontal line is <em>close</em> to what we want, but not quite there. For instance, notice that it stretches all the way across the pricing table. We actually want it narrower and centered.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-5.jpg" alt="screenshot" width="510"/></div>
<p>Styling an hr can be tricky and frustrating if you don&#8217;t know what you&#8217;re doing. You&#8217;d think that all we would have to do is set the width and color and we&#8217;d be good to go, but that&#8217;s not the case.</p>
<p>By default, certain browsers apply some weird styles that you have to clear. To be sure we get the look we want, we have to clear the borders, declare both a height and width, and set a background color. Then we center it using basic math: if our table is 250px wide and our line is 190px, that leaves 60px of width left. Using margins, we cut that value in half and assign thirty pixels of space to the left side of the line.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.pricingtable</span> hr <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#BCBEC0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#BCBEC0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">190px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Progress Update</h3>
<p>With that bit of styling, our little line is looking exactly like we want it to. Feel free to experiment with your hr to see what sort of fancy styles you can make. CSS-Tricks has some <a href="http://css-tricks.com/simple-styles-for-horizontal-rules/">great examples</a> for inspiration.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-6.jpg" alt="screenshot" width="510"/></div>
<h2>Price</h2>
<p>Next up is the price tag. This comes in two parts, the big price and the small text underneath that says &#8220;per month.&#8221; The tricky part is that, in the original design, the dollar sign is superscript. </p>
<p>I wanted to be semantic about this so I went ahead and used the &#8220;sup&#8221; tag. Some sources seem to think that this is a deprecated tag, but as far as I can tell, that&#8217;s not the case. Both sub and sup appear to be valid in HTML5 and have plenty of browser support across the board. I&#8217;m open to opposing arguments here, so let me know in the comments if you disagree.</p>
<p>Another potential point for a huge semantic argument here is my use of h1. Some would no doubt reserve h1 for the plan title at the top, but the price point here seemed to be the most important piece of information (importance trumps order), so I thought it was best to utilize it here. Once again, feel free to disagree and go your own way. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pricingtable&quot;</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Basic<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Full<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Support<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>25GB<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> of Storage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>5<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Domains<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>10<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Addresses<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">hr</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">sup</span>&gt;</span>$<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">sup</span>&gt;</span>25<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>per month<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now for our CSS we have three different things to target: the h1, the h1 sup and the paragraph. There&#8217;s nothing fancy here, just some more font-sizing and a little bit of margins to scoot things into place. Notice that all we need to do for the sup tag is reduce the font size. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.pricingtable</span> h1 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span> <span style="color: #933;">88px</span>/<span style="color: #cc66cc;">1</span> Helvetica<span style="color: #00AA00;">,</span> Verdana<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.pricingtable</span> h1 sup <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">45px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.pricingtable</span> p <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">500</span> <span style="color: #933;">14px</span>/<span style="color: #cc66cc;">1</span> Helvetica<span style="color: #00AA00;">,</span> Verdana<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#BCBEC0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Progress Update</h3>
<p>Our pricing table is nearly complete! Thus far we&#8217;ve conquered the four most difficult pieces of the puzzle, all that&#8217;s left is to create a button at the bottom. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-7.jpg" alt="screenshot" width="510"/></div>
<h2>The Button</h2>
<p>To finish off our pricing table, let&#8217;s put a sign up button at the bottom. To accomplish this, just throw an anchor tag into your HTML. This will finish up our reusable pricingtable div.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pricingtable&quot;</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Basic<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Full<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Support<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>25GB<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> of Storage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>5<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Domains<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>10<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Addresses<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">hr</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">sup</span>&gt;</span>$<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">sup</span>&gt;</span>25<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>per month<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Sign Up<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>To turn this simple text link into a button, set the display to block and define a width and height. Also be sure to fix the default link styling by setting the color and text-decoration. I transformed the text into uppercase as well to match the original design. Finally, apply the same border-radius as before.</p>
<p>To finish off the button, you can use a solid color to keep things simple, but I opted for a basic gradient that gets lighter when you hover over it. It&#8217;s a big, scary chunk of CSS but don&#8217;t worry, it&#8217;s all fairly basic. Use a free tool like <a href="http://www.colorzilla.com/gradient-editor/">this one</a> to save you some trouble if you&#8217;re creating your own gradient.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.pricingtable</span> a <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">150px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">500</span> <span style="color: #933;">16px</span>/<span style="color: #933;">40px</span> Helvetica<span style="color: #00AA00;">,</span> Verdana<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
&nbsp;
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
     -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
          border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*Gradient*/</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#9dcc55</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Old browsers */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#9dcc55</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#96c23d</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* FF3.6+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#9dcc55</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">100%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#96c23d</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome,Safari4+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#9dcc55</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#96c23d</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome10+,Safari5.1+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -o-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#9dcc55</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#96c23d</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Opera 11.10+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -ms-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#9dcc55</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#96c23d</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE10+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#9dcc55</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#96c23d</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* W3C */</span>
  filter<span style="color: #00AA00;">:</span> progid<span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span>.gradient<span style="color: #00AA00;">&#40;</span> startColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#9dcc55'</span><span style="color: #00AA00;">,</span> endColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#96c23d'</span><span style="color: #00AA00;">,</span>GradientType<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE6-9 */</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.pricingtable</span> a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#b2e560</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Old browsers */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#b2e560</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#96c23d</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* FF3.6+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#b2e560</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">100%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#96c23d</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome,Safari4+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#b2e560</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#96c23d</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome10+,Safari5.1+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -o-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#b2e560</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#96c23d</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Opera 11.10+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -ms-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#b2e560</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#96c23d</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE10+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#b2e560</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#96c23d</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* W3C */</span>
  filter<span style="color: #00AA00;">:</span> progid<span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span>.gradient<span style="color: #00AA00;">&#40;</span> startColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#b2e560'</span><span style="color: #00AA00;">,</span> endColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#96c23d'</span><span style="color: #00AA00;">,</span>GradientType<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE6-9 */</span>
&nbsp;
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Progress Update</h3>
<p>With that, our first pricing table is complete! If we wanted to go further, we could grab a slab serif web font to make it look just like the PSD, but I like the Helvetica just fine here. Now we have to take this one item and turn it into three!</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-8.jpg" alt="screenshot" width="510"/></div>
<h2>Making Three Tables</h2>
<p>To expand this into three unique tables, copy and paste the HTML that you just created so that you have three pricingtable divs and place them all inside of a container div. Then customize the text on each so that the features and price point are correct. Finally, add a &#8220;featured&#8221; class to the second table. We&#8217;ll us this to pull off the enlarged effect. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pricingtable&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Basic<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Full<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Support<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>25GB<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> of Storage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>5<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Domains<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>10<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Addresses<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">hr</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">sup</span>&gt;</span>$<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">sup</span>&gt;</span>25<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>per month<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Sign Up<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pricingtable featured&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Pro<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Full<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Support<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>50GB<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> of Storage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>10<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Domains<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>20<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Addresses<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">hr</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">sup</span>&gt;</span>$<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">sup</span>&gt;</span>49<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>per month<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Sign Up<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pricingtable&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Premium<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Full<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Support<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Unlimited<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Storage<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Unlimited<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Domains<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>50<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;</span> Email Addresses<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">hr</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">sup</span>&gt;</span>$<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">sup</span>&gt;</span>79<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>per month<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Sign Up<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>To make the pricing tables appear next to each other, go back to your pricingtable class and float it left. Also apply a width of 780px to your container and center it on the page with auto left and right margins. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">780px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.pricingtable</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">250px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">450px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
&nbsp;
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
     -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
          border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">9px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
     -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">9px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
          box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">9px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now we have three pricing tables in a row, which is exactly what we want. However, remember that the center one should be larger than the other two, this is not yet the case.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-9.jpg" alt="screenshot" width="510"/></div>
<p>Instead of manually going through and adjusting each little set of dimensions throughout the center pricing table, we can target the unique class that we gave it and apply a CSS transformation to enlarge it. Since all of our content is pure code (no images), the scaled up version should look just fine.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.featured</span> <span style="color: #00AA00;">&#123;</span>
	-webkit-transform<span style="color: #00AA00;">:</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	-moz-transform<span style="color: #00AA00;">:</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	-o-transform<span style="color: #00AA00;">:</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	-ms-transform<span style="color: #00AA00;">:</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	transform<span style="color: #00AA00;">:</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.2</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">1.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h2>All Finished!</h2>
<p>With that, our CSS pricing tables are complete. The last transformation gave us exactly the effect that we wanted with the center table larger and floating over the other two. Check out the live demo versions below.</p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/pricingtables/index.html">Click here</a> to launch demo<br />
<strong>Code:</strong> See and tweak the source code at <a href="http://dabblet.com/gist/1753915">Dabblet</a></p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-pricingtables-10.jpg" alt="screenshot" width="510"/></div>
<h2>Conclusion</h2>
<p>I hope you enjoyed building these pricing tables and will get some good use out of them. Use them however you wish and be sure to download the PSD and vector versions from <a href="http://designcurate.com/resource/pricing-tables">Design Curate</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/csspricingtables/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Code a Useful Expanding Vertical Navigation Menu</title>
		<link>http://designshack.net/articles/css/verticalaccordionav/</link>
		<comments>http://designshack.net/articles/css/verticalaccordionav/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 06:00:44 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[vertical]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=29230</guid>
		<description><![CDATA[Today we have yet another awesome step-by-step CSS project for you! This time around we&#8217;re going to build a super useful expanding vertical navigation menu. It&#8217;s a great way to hide a lot of links in a fairly small space and the animations will add a nice touch to your site. Even if you&#8217;re a [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-0.jpg" alt="screenshot" width="510"/></div>
<p>Today we have yet another awesome step-by-step CSS project for you! This time around we&#8217;re going to build a super useful expanding vertical navigation menu. It&#8217;s a great way to hide a lot of links in a fairly small space and the animations will add a nice touch to your site.  </p>
<p>Even if you&#8217;re a complete beginner, you should be able to pull this off. I&#8217;ll guide you along every step of the way and explain how each chunk of code works so you can implement these same techniques in future projects and deepen your understanding of CSS. Let&#8217;s get started!</p>
<p><span id="more-29230"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>The Concept</h2>
<p>Before we start coding, it&#8217;s always helpful to lay out the rough concept of what you want to achieve so you can wrap your brain around what&#8217;s going to be involved. The item we&#8217;re building today is a vertical navigation menu that&#8217;s in a sort of modified accordion format (get a sneak peek of the finished product <a href="http://designshack.net/tutorialexamples/verticalnav/index.html">here</a>).</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-1.jpg" alt="screenshot" width="510"/></div>
<p>As you can see, the sections on the bottom are closed by default and slide open when you over over them. However, to add some nice variation we&#8217;ll also include a section that stays open all of the time. In the main section that is always open we&#8217;ll include a brief welcome message and in the sections that slide open will be sub-sections of navigation links. </p>
<p>Now that we have a good idea of where we&#8217;re going, let&#8217;s start outlining the structure in our HTML.</p>
<h2>The HTML</h2>
<p>The first thing we&#8217;re going to do is toss in some nice HTML5 to wrap the menu in. The new nav element provides a beautifully semantic container for our menu.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;nav&gt;</span>
  <span style="color: #808080; font-style: italic;">&lt;!-- all nav code here --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>nav&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now let&#8217;s think about how our menu is going to be structured. We&#8217;re not simply going to have a list of links, each bar represents a link with an additional area below it. We&#8217;ll wrap these up in a div. Then within each div we&#8217;ll need a main link (the colored bar) and a list of sub-links (the white area). Assuming that this item will be thrown into a site that already has some default styling, let&#8217;s arbitrarily settle on h4 for the main link and a simple unordered list for the rest.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;nav&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h4</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Portfolio<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h4</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- colored bar --&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- expanding white area --&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Web<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Print<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Other<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>nav&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>We can copy, paste and modify this section of code to make up the various pieces of our navigation menu. Here we have a Portfolio, About, and Contact section, each with three sub-links. Each section is given the same class (menu-item) so we can style them in one go. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;nav&gt;</span> 
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h4</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Portfolio<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h4</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Web<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Print<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Other<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h4</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>About<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h4</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>History<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Meet The Owners<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Awards<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h4</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Contact<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h4</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Phone<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Email<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Location<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>nav&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>I wanted to focus on those areas first because they&#8217;re all the same, but remember that the top section is actually different, both in functionality and content. Instead of holding an unordered list, it will hold a paragraph. We&#8217;ll also add in a unique class to make it that much easier to target in our CSS.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;nav&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item alpha&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h4</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Home<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h4</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Lorem ipsum dolor sit...<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h4</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Portfolio<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h4</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Web<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Print<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Other<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h4</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>About<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h4</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>History<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Meet The Owners<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Awards<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu-item&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h4</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Contact<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h4</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Phone<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Email<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Location<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>nav&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>With that, we&#8217;re already finished with the HTML. Though it&#8217;s not styled at all, the live preview perfectly showcases the hierarchy of our navigation menu. Here you can clearly see our menu beginning to take form.  </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-2.jpg" alt="screenshot" width="510"/></div>
<h2>Base Styles</h2>
<p>To start off our menu styling, we need to establish a few basics. First, we&#8217;ll clear the default margins and padding. We&#8217;ll be squishing the divs right up next to each other so any default browser spacing will ruin the layout.</p>
<p>Next, we&#8217;ll apply a simple color to the background so the white portions of our menu will stand out. Then we&#8217;ll toss in some basic font styles and add a slight shadow to the menu. Note that the margin set in the nav block centers the menu on the page, this is for display purposes only and should be removed when you want to nudge the menu into place.</p>
<p>Finally, we&#8217;ll add some dimensions and background color to the nav and menu-item selectors. Here&#8217;s the resulting code:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
body <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#e5e5e7</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
nav <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Helvetica<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> <span style="color: #ff0000;">&quot;Lucida Grande&quot;</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1.5</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*for display only*/</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
  -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">5px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
     -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">5px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
          box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">5px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.menu-item</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>A this point, the preview is looking like we&#8217;ve done more harm than good, but fear not, it&#8217;ll start looking spiffy in no time.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-3.jpg" alt="screenshot" width="510"/></div>
<h2>Header Styles</h2>
<p>Now it&#8217;s time to style our h4 tags and turn them into the horizontal bars that we saw in our mockup. To do this, we just need a little padding and a background color. While we&#8217;re here we can begin to style the typography as well. We&#8217;re inheriting the font-family we set up before so we don&#8217;t need to re-type that. Instead we just need to set a size and weight. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*Menu Header Styles*/</span>
<span style="color: #6666ff;">.menu-item</span> h4 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">500</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#a90329</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>As you can see in the image below, our link styles are still overriding some of the type styles we set here so we&#8217;ll need to go in and fix those next. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-4.jpg" alt="screenshot" width="510"/></div>
<h3>Header Links</h3>
<p>Obviously, the blue link is no good so we need to change that to white. We also want to ditch any text decoration (the underline). Now, we could stop here but the default behavior would be that only the text is clickable and not the whole bar, which is not ideal. To make the entire bar a link, we set the display property to block and the width to the full menu size (200px).</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.menu-item</span> h4 a <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now our colored bar is looking much better. Here&#8217;s the preview:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-5.jpg" alt="screenshot" width="510"/></div>
<h3>Making It Pretty</h3>
<p>If you want to stick with something simple, you can skip this step, but I&#8217;m going to trudge on and add a few more visual tweaks. Go back and modify that header style block to include a gradient and some very subtle borders. You likely won&#8217;t even be able to spot the borders until the menu is closed, but combined with the gradients they&#8217;ll really help differentiate each section so they don&#8217;t all look like one big block. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*Menu Header Styles*/</span>
<span style="color: #6666ff;">.menu-item</span> h4 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">500</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*Gradient*/</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#a90329</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Old browsers */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#a90329</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#8f0222</span> <span style="color: #933;">44%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#6d0019</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* FF3.6+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#a90329</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">44%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#8f0222</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">100%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#6d0019</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome,Safari4+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#a90329</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#8f0222</span> <span style="color: #933;">44%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#6d0019</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome10+,Safari5.1+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -o-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#a90329</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#8f0222</span> <span style="color: #933;">44%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#6d0019</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Opera 11.10+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -ms-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#a90329</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#8f0222</span> <span style="color: #933;">44%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#6d0019</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE10+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#a90329</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#8f0222</span> <span style="color: #933;">44%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#6d0019</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* W3C */</span>
  filter<span style="color: #00AA00;">:</span> progid<span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span>.gradient<span style="color: #00AA00;">&#40;</span> startColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#a90329'</span><span style="color: #00AA00;">,</span> endColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#6d0019'</span><span style="color: #00AA00;">,</span>GradientType<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE6-9 */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-6.jpg" alt="screenshot" width="510"/></div>
<h3>Hover Styles</h3>
<p>Next we&#8217;re going to add a subtle hover style to the bar links. All we&#8217;re going to do is tweak the colors on the gradient a little so they get brighter when you hover.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.menu-item</span> h4<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>  
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#cc002c</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Old browsers */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#cc002c</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#6d0019</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* FF3.6+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#cc002c</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">100%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#6d0019</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome,Safari4+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#cc002c</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#6d0019</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome10+,Safari5.1+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -o-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#cc002c</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#6d0019</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Opera 11.10+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -ms-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#cc002c</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#6d0019</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE10+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#cc002c</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#6d0019</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* W3C */</span>
  filter<span style="color: #00AA00;">:</span> progid<span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span>.gradient<span style="color: #00AA00;">&#40;</span> startColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#cc002c'</span><span style="color: #00AA00;">,</span> endColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#6d0019'</span><span style="color: #00AA00;">,</span>GradientType<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE6-9 */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-7.jpg" alt="screenshot" width="510"/></div>
<h2>Paragraph Styles</h2>
<p>Remember that the first item in our menu holds a paragraph and not an unordered list, so next we&#8217;ll attack this to get it looking nice. The lists will take a sizable chunk of code but the paragraph hardly requires anything. Just define the size and color, then toss in some padding. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*First Item Styles*/</span>
<span style="color: #6666ff;">.alpha</span> p <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#aaa</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>The top section is now looking great! Both the header bar and the paragraph are exactly where we need them to be.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-8.jpg" alt="screenshot" width="510"/></div>
<h2>Unordered List Styles</h2>
<p>There&#8217;s a ton of stuff that we need to do to get these lists straightened out. Let&#8217;s switch things up a bit and look at the code first, then I&#8217;ll walk you through it.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*ul Styles*/</span>
<span style="color: #6666ff;">.menu-item</span> ul <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.menu-item</span> ul a <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#aaa</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*li Styles*/</span>
<span style="color: #6666ff;">.menu-item</span> li <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#eee</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.menu-item</span> li<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#eee</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>As you can see, the first block targets the unordered list as a whole unit. Here I set some basic sizing and font styles and removed the bullet point by setting list-style-type to none. </p>
<p>Next I targeted the links specifically. I moved them over, removed the underlines, set the color and performed the same display:block trick that we saw before to make the clickable area larger. </p>
<p>To finish things off, I applied a few custom styles to the list items themselves. The bottom border creates a separation between each item and the hover style changes the background. Here&#8217;s the result of our labor, our menu is almost finished!</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-9.jpg" alt="screenshot" width="510"/></div>
<h2>Collapse And Animate</h2>
<p>Up to this point, we&#8217;ve kept our menu opened up so that we could see it while we style the elements within. Now that we know that all of our visual styles are exactly like we want them, it&#8217;s time to collapse each section and then set them up to pop open on hover.</p>
<p>By default, browsers will set the height of those unordered lists to auto, meaning they&#8217;ll be just tall enough to hold all of the content within. To collapse the menu sections so that only the bars show, we can target those unordered lists and set the height to 0. Notice that we&#8217;re leaving the paragraph alone, this will ensure that our top section is always open.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*ul Styles*/</span>
<span style="color: #6666ff;">.menu-item</span> ul <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*Collapses the menu*/</span>
  <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now our menu is much shorter and doesn&#8217;t eat up so much space. You can also finally see the benefit of those gradients and borders that we implemented before. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-10.jpg" alt="screenshot" width="510"/></div>
<h3>Animating the Transition</h3>
<p>Next we&#8217;ll want to open these menus back up on hover, but before we do that, let&#8217;s set up an animation so the transition is nice and gradual. Make sure you insert the various browser extensions and target the height property.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*ul Styles*/</span>
<span style="color: #6666ff;">.menu-item</span> ul <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*Animation*/</span>
  -webkit-transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">height</span> 1s ease<span style="color: #00AA00;">;</span>
     -moz-transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">height</span> 1s ease<span style="color: #00AA00;">;</span>
       -o-transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">height</span> 1s ease<span style="color: #00AA00;">;</span>
      -ms-transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">height</span> 1s ease<span style="color: #00AA00;">;</span>
          transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">height</span> 1s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Expanding on Hover</h3>
<p>All that&#8217;s left to do now is make it so that when you hover, the ul expands. This is tricky though so be careful. Your instinct may be to do something like &#8220;ul:hover&#8221; but that&#8217;s not what we want. Instead, we want to make it so that you can hover anywhere in that menu item, either in the bar or the unordered list. However, the item that we want expanded is still only the ul. Here&#8217;s what our selector looks like:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.menu-item</span><span style="color: #3333ff;">:hover </span>ul <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">93px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Sometimes reading a selector backwards is helpful when trying to figure out what it does. This tells our browser to set a height of 93px to our unordered lists when a .menu-item is hovered over.  </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssvertmenu-11.jpg" alt="screenshot" width="510"/></div>
<p>One important thing to note here is that we can&#8217;t just set the height to auto because for some reason this  disables the animation. If you don&#8217;t want the animation, a height of auto is much more flexible and allows you to vary the number of sub-menu items. If you want to do this with the animation, you&#8217;ll have to target the height for each individually. </p>
<h2>See It In Action</h2>
<p>Our menu is now complete. Be sure to kick the tires in the demo to see how it all works. I&#8217;ll also throw in a link to the completed code so you can have a look at it all together.</p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/verticalnav/index.html">Launch Demo</a><br />
<strong>See the Code:</strong> Check out the HTML and CSS on <a href="http://tinkerbin.com/DDeWwqTq">Tinkerbin</a></p>
<h2>Conclusion</h2>
<p>I hope you enjoyed this walkthrough of building an animated vertical navigation menu. In implementation, it&#8217;s very similar to the <a href="http://designshack.net/articles/css/downloadbutton/">animated download buttons</a> that we built the other day so you should really be getting the hang of hiding and showing content using pure CSS. </p>
<p>Look out for an even better version of this menu to pop up on our brand new sister site, <a href="http://designcurate.com/">Design Curate</a>. You&#8217;ll find a ton of great freebies there that you can download and implement in your projects today. </p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/verticalaccordionav/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>5 Online Playgrounds for HTML, CSS and JavaScript Compared</title>
		<link>http://designshack.net/articles/css/5-online-playgrounds-for-html-css-and-javascript-compared/</link>
		<comments>http://designshack.net/articles/css/5-online-playgrounds-for-html-css-and-javascript-compared/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 06:00:45 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=29124</guid>
		<description><![CDATA[Local coding environments are great, but it&#8217;s often the case that I don&#8217;t want to crack open Espresso and spend a few minutes setting up to code when all I really want is to test out an idea or work on a bug. Also, sharing options for most local coding apps are limited and typically [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-14.jpg" alt="screenshot" width="510"/></div>
<p>Local coding environments are great, but it&#8217;s often the case that I don&#8217;t want to crack open Espresso and spend a few minutes setting up to code when all I really want is to test out an idea or work on a bug. Also, sharing options for most local coding apps are limited and typically require integrating an outside app like Dropbox.</p>
<p>Online playgrounds or sandboxes such as jsFiddle solve this problem by providing you with an instantly ready coding environment for you to begin experimenting in as soon as the page loads. These tools let you combine CSS, HTML and often even JavaScript to create and share coding examples. I&#8217;m completely addicted to these things and have extensively tested every one I can get my hands on. Today I&#8217;ll go over my five favorites and discuss not only why what I like about each option, but also where they fall short. </p>
<p><span id="more-29124"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2><a href="http://cssdesk.com/">CSSDesk</a></h2>
<div class="tutorialimage"><a href="http://cssdesk.com/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-2.jpg" alt="screenshot" width="510"/></a></div>
<p>I&#8217;ll start with CSSDesk because it&#8217;s one of the oldest on this list. It&#8217;s been around for years now as a quiet and obscure little tool that is extremely helpful for playing with basic web code. CSSDesk is a very simple tool that focuses purely on HTML and CSS. </p>
<h3>What I Like About CSSDesk</h3>
<p>There are a lot of things that I just love about CSS Desk. There are three main sections: HTML, CSS and live preview, the sizes of which can all be easily tweaked with a click and drag. I like that you can easily see everything you need in one simple view. There&#8217;s no effort or setup here, just load the page and start creating.</p>
<p>There&#8217;s also basic syntax highlighting just like all of the other tools on this list. However, one fairly unique feature that you don&#8217;t often see in these types of tools is line numbers. It&#8217;s such a simple addition but I tend to like line numbers so I really appreciate the inclusion.  </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-7.jpg" alt="screenshot" width="510"/></div>
<p>The toolbar features are pretty cool as well, providing some options that you simply don&#8217;t find other places. In addition to the standard sharing feature, you also have the option to download what you just built. Further, there&#8217;s a set of default tiling background textures that are applied if you don&#8217;t manually override them. These are fun if you&#8217;re just building a button or widget of some kind and want something other than the typical plain white background.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-6.jpg" alt="screenshot" width="510"/></div>
<h3>What I Don&#8217;t Like About CSSDesk</h3>
<p>Honestly, there&#8217;s not much to dislike about this one. Sure, it&#8217;s simple and doesn&#8217;t have some of the fancy features the other options have, but that&#8217;s also what makes it great. I hardly ever use this one anymore but every time I do it&#8217;s so nice I think I should stop by more often.</p>
<p>The biggest downside for hardcore coders is the lack of JavaScript support. If this is a deal breaker for you, try checking out one of the other options.</p>
<h2><a href="http://jsbin.com/">JS Bin</a></h2>
<div class="tutorialimage"><a href="http://jsbin.com/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-1.jpg" alt="screenshot" width="510"/></a></div>
<p>JS Bin is another popular place to tinker around with your code. The design of this app is quite minimal and really allows you to focus on the code. By default, the page only shows the HTML and live preview panes, but you can easily add JavaScript to that as well. </p>
<h3>What I Like About JS Bin</h3>
<p>There are quite a few nice features on JS Bin. The first thing that I found myself appreciating is the fact that refreshing the page doesn&#8217;t kill your work. The preview updates automatically but for those rare times when you do need a manual refresh, it&#8217;s nice that your first instinct (Command-R) doesn&#8217;t result in the accidental loss of an hour&#8217;s worth of tinkering.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-8.jpg" alt="screenshot" width="510"/></div>
<p>As with CSSDesk, you save, share and download your work. The place where this obviously pulls ahead though is the JavaScript implementation. You can obviously enter your own JS but as a bonus you can choose to include popular libraries like jQuery. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-9.jpg" alt="screenshot" width="510"/></div>
<p>Another cool feature is the ability to control which panes you see by manipulating the URL. For instance, &#8220;http://jsbin.com/#javascript,html,live&#8221; will get you all three panes while &#8220;http://jsbin.com/#html,live&#8221; will just get you two.</p>
<h3>What I Don&#8217;t Like About JS Bin</h3>
<p>To be honest, JS Bin is my least favorite option on this list. It&#8217;s not bad, but it definitely lacks the charm of the others. One thing that always gets me is that there&#8217;s no dedicated place for CSS, forcing you to embed it into your HTML. This works just fine, but it&#8217;s not as nice as the intentional separation seen in the other options.</p>
<h2><a href="http://jsfiddle.net/">jsFiddle</a></h2>
<div class="tutorialimage"><a href="http://jsfiddle.net/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-3.jpg" alt="screenshot" width="510"/></a></div>
<p>jsFiddle has completely taken off in the past few months to a year and is probably the most popular option on this list at the moment. And for good reason, this is one amazing app. Let&#8217;s face it, once you dig into jsFiddle, you may never look at any of the other options again. </p>
<h3>What I Like About jsFiddle</h3>
<p>There are a ton of great things to cover in my list of reasons why you should use jsFiddle. First up is the layout. There are four panels (HTML, CSS, JavaScript and preview) so you can see everything you need to at once and resize each area on the fly. The layout system here feels really flexible and is actually sort of fun to play with.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-10.jpg" alt="screenshot" width="510"/></div>
<p>While we&#8217;re discussing panels, you can customize the CSS and JavaScript panels to utilize your favorite third party tools. You&#8217;ll find support for the Sass SCSS syntax and CoffeeScript. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-11.jpg" alt="screenshot" width="510"/></div>
<p>jsFiddle lets you create a login and view a dashboard of your past saved work. There are a ton of menu options and tools once you&#8217;ve saved a fiddle, my favorites are the ability to quickly create a fork and the option to automatically tidy up your messy code structure.   </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-12.jpg" alt="screenshot" width="510"/></div>
<p>In addition to the panel customization options, the sidebar has a bunch of other great features as well. For instance, you can quickly add both any major libraries that you want to include (jQuery, MooTools, etc.) and your own JavaScript/CSS resources. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-13.jpg" alt="screenshot" width="510"/></div>
<p>One last amazing jsFiddle option that I only just discovered the other day: you can embed fiddles into a webpage. This option is found under the share menu and is a great alternative to other code embedding services.</p>
<h3>What I Don&#8217;t Like About jsFiddle</h3>
<p>My main beef with jsFiddle is the lack of an auto update option for the preview. Once you&#8217;ve used all the other options on this list and experienced the joys of auto update, it&#8217;s hard to put up with manual refreshes every few seconds in jsFiddle.</p>
<p>As far as other features go, it&#8217;s the best on the list but that one annoyance often drives me elsewhere if I just want to bust out a quick test. Keyboard shortcuts help, but they&#8217;re still not as nice as something automatic. </p>
<h2><a href="http://dabblet.com/">Dabblet</a></h2>
<div class="tutorialimage"><a href="http://dabblet.com/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-4.jpg" alt="screenshot" width="510"/></a></div>
<p>Dabblet is a fairly new kid on the block in this genre. Like CSSDesk, it focuses on only HTML and CSS with no JavaScript. However, don&#8217;t count it out because it brings some serious innovation to the table that you won&#8217;t find in any other editor. </p>
<h3>What I Like About Dabblet</h3>
<p>By default, Dabblet is split into three tabs: CSS &#038; Result, HTML &#038; Result and Result. This provides flexibility and focus while allowing you to always keep an eye on the result.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-15.jpg" alt="screenshot" width="510"/></div>
<p>You can change things up with the controls shown below. The split can be vertical, horizontal or taken out completely. There&#8217;s also an interesting &#8220;behind code&#8221; mode where your result is simply the background for the coding area. Notice there&#8217;s also a message about using prefix-free. I use Dabblet all the time and never noticed this until just now! This means that you don&#8217;t have to use crazy vendor prefixes and can code the simple defaults, the hidden JavaScript will make sure your browsers interprets it correctly. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-14.jpg" alt="screenshot" width="510"/></div>
<p>Dabblet has some great saving options as well such as &#8220;save anonymously.&#8221; It also links to your GitHub account, which coding nerds like will love. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-16.jpg" alt="screenshot" width="510"/></div>
<p>My favorite Dabblet feature is the super slick hover effect integration in the CSS. They&#8217;re easier to show that describe. Here two few examples:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-17.jpg" alt="screenshot" width="510"/></div>
<p>As you can see, hovering over certain bits of CSS brings up these little tooltips that are really great. You can get previews for fonts, colors, sizes, and even images.</p>
<h3>What I Don&#8217;t Like About Dabblet</h3>
<p>Dabblet is a bit quirky from a visual perspective, you either love it or hate it. I personally really enjoy using it but really wish that I had more control over the panel size. Having an auto 50/50 split is great, but I should be able to manually adjust that however I choose. </p>
<p>As far as I know, there&#8217;s also no way to view your HTML and CSS at the same time, which is a little annoying if you&#8217;re used to options like jsFiddle where you can keep an eye on everything at once. </p>
<h2><a href="http://tinkerbin.com/">Tinkerbin</a></h2>
<div class="tutorialimage"><a href="http://tinkerbin.com/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-5.jpg" alt="screenshot" width="510"/></a></div>
<p>Tinkerbin is the closest alternative to jsFiddle that I&#8217;ve found. Though it doesn&#8217;t have all of the fancy features found in jsFiddle, it has a few tricks of its own that are really nice.</p>
<h3>What I Like About Tinkerbin</h3>
<p>The default panel layout on Tinkerbin is probably my favorite on this entire list. It&#8217;s a very logical layout that puts the code on the left and a nice big auto-updating preview on the right. The HTML, CSS and JavaScript sections are all stacked on top of each other, with optional tabs that allow you to focus on just one of these. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-18.jpg" alt="screenshot" width="510"/></div>
<p>Further, Tinkerbin supports even more alternate syntax options than jsFiddle. You can choose HTML or HAML; CSS, SCSS (with Compass), the old SASS syntax or LESS; and JavaScript or CoffeeScript. Needless to say, if you dig preprocessors, this is the option for you.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-19.jpg" alt="screenshot" width="510"/></div>
<p>Tinkerbin is the only option that allows you to swap out your preview for a nice, extensive &#8220;View Source&#8221; window.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/fiddlers-20.jpg" alt="screenshot" width="510"/></div>
<h3>What I Don&#8217;t Like About Tinkerbin</h3>
<p>Even more so than Dabblet, the Tinkerbin layout is completely rigid. Sure, I like the default setup the best, but sometimes I want to make that preview wider and I simply don&#8217;t have the option here.</p>
<p>Further, the saving options aren&#8217;t the best. There&#8217;s no account setup, dashboard, GitHub integration, etc. You simply save your experiments to a shortened URL. </p>
<h2>Conclusion</h2>
<p>By now I&#8217;m sure you can see the benefits of having a few of these sites bookmarked. I encourage you to experiment as often as possible with new ideas to keep yourself fresh and these services provide an awesome way to do it.</p>
<p>I hope this review has served as a helpful look into the details of each of these solutions. You should now know not only what makes each option unique but also where each falls short. This will help you make an informed decision about which one or two to primarily focus on.</p>
<p>I personally bounce back and forth with all of them fairly regularly but lately I&#8217;ve been hanging out mostly in jsFiddle, Dabblet and Tinkerbin. Which of these is your favorite and why?</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/5-online-playgrounds-for-html-css-and-javascript-compared/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Code an Awesome Animated Download Button With CSS3</title>
		<link>http://designshack.net/articles/css/downloadbutton/</link>
		<comments>http://designshack.net/articles/css/downloadbutton/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 06:00:43 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[download]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=28910</guid>
		<description><![CDATA[Follow along as we create a simple and fun download button using some fancy CSS3. Our button will use lots of fun goodies including border-radius, box-shadow, linear-gradients, z-index and transitions to achieve a unique double sliding drawer effect on hover. As we go, I&#8217;ll discuss why some techniques that you might think to use should [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/anim-download-0.jpg" alt="screenshot" width="510"/></div>
<p>Follow along as we create a simple and fun download button using some fancy CSS3. Our button will use lots of fun goodies including border-radius, box-shadow, linear-gradients, z-index and transitions to achieve a unique double sliding drawer effect on hover. </p>
<p>As we go, I&#8217;ll discuss why some techniques that you might think to use should be avoided. Transitions are tricky to work with and are quite prone to refuse to work with certain properties. Read on to find out more. </p>
<p><span id="more-28910"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>The Concept</h2>
<p>Loosely based on <a href="http://dribbble.com/shots/339317-Krazy-Download-Buttons-V2-1">this idea</a>, I wanted to create a download button with a cool sliding drawer effect where originally hidden information pops out when the user begins a hover event. To put my own spin on it, I decided to double the effect and create a drawer on both the top and bottom of the button (<a href="http://designshack.net/tutorialexamples/animatedDownload/index.html">click here</a> for a sneak peek of the finished result).</p>
<p>Here&#8217;s how it will work: using a combination of HTML and CSS, we&#8217;ll create three separate pieces. These include the main button and two smaller info panels. The smaller panels will initially hide under the larger button, then when the user hovers, one will slide upward and the other downward. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/anim-download-1.jpg" alt="screenshot" width="510"/></div>
<p>As you can see, this will be a pretty easy project that is perfect for beginners that are looking to up their CSS skills. Especially worth learning is how we&#8217;ll utilize absolute positioning and stacking via z-index. </p>
<h2>What Won&#8217;t Work</h2>
<p>As I planned out this project, I came up with a couple of ways to make my concept work. Given that I&#8217;ve been on a <a href="http://designshack.net/articles/css/the-lowdown-on-before-and-after-in-css/">pseudo element</a> kick lately, the way that I chose to structure the project initially was through the use of :before and :after. </p>
<p>With these pseudo elements, we can code only the download button in our HTML and then add in the wings using pure CSS. It seems like an optimal solution and indeed it worked great&#8230; until I tried to animate the transition. No matter what I tried, I simply couldn&#8217;t get the transition to work.</p>
<p>After a little research I discovered that that only Firefox supports CSS transitions on pseudo elements. This is a real bummer that really limits the fun we can have with :before and :after, but on the upside I learned a valuable lesson that will save me a lot of time and trouble in the future.</p>
<p>In tutorials like this one you don&#8217;t often get to hear about where the author failed, but I think it&#8217;s important to communicate these failures so you can learn from them as I have. Now the next time you want to animate a pseudo element you&#8217;ll remember that it won&#8217;t work in most browsers!</p>
<p>Failures aside, let&#8217;s jump into a method that <em>will</em> work.</p>
<h2>The Button</h2>
<p>To begin, we&#8217;ll create and style our button. Once we have this in place, it&#8217;ll be easier to form the other elements. All we need in the HTML department is a single div containing a link. We could simply use the link for the button but we&#8217;ll need to group multiple objects together so a div is necessary.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Download<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Button Shape &#038; Size</h3>
<p>The HTML above should simply provide you with a plain text link. We&#8217;re going to transform this into a button with a set background shape and size. To do this, we start with some dimensions, add some color and set the display value to block.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span> a <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#00b7ea</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Here&#8217;s a look at what your button should look like after this step. It doesn&#8217;t look like much yet, but it&#8217;ll be a fancy looking button before you know it.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/anim-download-2.jpg" alt="screenshot" width="510"/></div>
<h3>Type Styles</h3>
<p>The first ugly thing about the button above that we&#8217;ll need to fix is the type, it&#8217;s currently a mess. Fortunately, this is easy to address. All we need to do is set the color to white, declare a font, and center it.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span> a <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#00b7ea</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*TYPE*/</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">17px</span>/<span style="color: #933;">50px</span> Helvetica<span style="color: #00AA00;">,</span> Verdana<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>There are a couple of interesting things to note here. First, notice that I&#8217;m using the &#8220;font&#8221; shorthand rather than running through reach font property individually. This is a great way to save space and keep your type styles nice and succinct. The order here is as follows:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/anim-download-3.jpg" alt="screenshot" width="510"/></div>
<p>Here&#8217;s another nifty trick: I set the line-height to 50px to center it vertically in the button. Also notice that I removed the text underline and transformed the type to be uppercase. Why didn&#8217;t I just type it out in all caps in HTML? Because this is really a style choice and could change with a future redesign. </p>
<p>Now our button is looking much better!</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/anim-download-4.jpg" alt="screenshot" width="510"/></div>
<h3>CSS3 Magic</h3>
<p>At this point our button is still looking a little plain. If you&#8217;re cool with the minimal look, you can skip ahead. Otherwise, let&#8217;s make it a little more interesting. The first thing we&#8217;ll do is round off the corners. Make sure you add all three browser prefixes:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
   -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
        border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span></pre></div></div>

</div>
<p></ br></p>
<p>Next up, we&#8217;ll toss in a box-shadow. Once again, we&#8217;ll need three versions to cover the various browsers. The shorthand value order here is horizontal offset, vertical offset, blur and color.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">-webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
   -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
        box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

</div>
<p></ br></p>
<p>Finally, we&#8217;ll toss in a gradient. Unfortunately, this requires a whole mess of code. The way gradients work recently change so not only do we need multiple prefixes, we also need multiple syntaxes to make sure we support everything. I&#8217;m going to be honest, I rarely code this stuff by hand. Instead, I use the <a href="http://www.colorzilla.com/gradient-editor/">Ultimate Gradient Generator</a> and paste in the generated code. Here&#8217;s the result:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#00b7ea</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#009ec3</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* FF3.6+ */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#00b7ea</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">100%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#009ec3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome,Safari4+ */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#00b7ea</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#009ec3</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome10+,Safari5.1+ */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -o-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#00b7ea</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#009ec3</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Opera 11.10+ */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -ms-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#00b7ea</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#009ec3</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE10+ */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#00b7ea</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#009ec3</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* W3C */</span>
filter<span style="color: #00AA00;">:</span> progid<span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span>.gradient<span style="color: #00AA00;">&#40;</span> startColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#00b7ea'</span><span style="color: #00AA00;">,</span> endColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#009ec3'</span><span style="color: #00AA00;">,</span>GradientType<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE6-9 */</span></pre></div></div>

</div>
<p></ br></p>
<p>Now our button is completely styled and looking fine. Here&#8217;s the result:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/anim-download-5.jpg" alt="screenshot" width="510"/></div>
<h2>Adding The Drawers</h2>
<p>Now that our primary button is done, it&#8217;s time to add the little drawers that will slide out from the top and bottom (perhaps &#8220;wings&#8221; is the appropriate term). To do this, we&#8217;ll start by adding a little bit to our HTML:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;button&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Download<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;top&quot;</span>&gt;</span>click to begin<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;bottom&quot;</span>&gt;</span>1.2MB .zip<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>As you can see, I basically tossed in two paragraphs, each with a unique class that makes them easy to target (you could use some pseudo selectors instead if you really want to get fancy).</p>
<h3>Default Paragraph Styling</h3>
<p>Now jump over to your CSS and we&#8217;ll style the paragraphs. To start, we want to focus on the styles that both paragraphs will share. Styling both at once where possible helps keep our code clean and less redundant. Here&#8217;s a big chunk of code to think over:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">180px</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-50px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*TYPE*/</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span>/<span style="color: #933;">45px</span> Helvetica<span style="color: #00AA00;">,</span> Verdana<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*POSITION*/</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> -<span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*CSS3*/</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
     -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
          border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
&nbsp;
  -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
     -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
          box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now, this is a lot to throw at you all at once so I&#8217;ll walk through it step by step. The first thing we do is give the paragraphs shape, color and type styles exactly like we did on the button. The main difference is that these are smaller and use some margins to push them into place. </p>
<p>Next are the positioning styles. These are very important so be sure you understand them clearly. In order to make the wings appear behind the button, we need to apply z-index, which affects the stacking order of the elements. Think of this as a &#8220;send to back&#8221; sort of command. To make this work, we need to apply absolute positioning.</p>
<p>Finally, we added the same border-radius and gradient styles that we did before. I&#8217;ve kept these separated from the previous styles to keep things simple and clear, but to make things DRYer, you would probably want to rewrite your shared CSS3 styles to something like this:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span> a<span style="color: #00AA00;">,</span> p <span style="color: #00AA00;">&#123;</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
     -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
          border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
&nbsp;
  -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
     -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
          box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>      
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Basically, any time you find yourself repeating or pasting styles multiple times, you&#8217;re making your code unnecessarily complex and should attempt to simplify. </p>
<p>At the end of this step, you&#8217;ll strangely see no change in your preview from last time. This is because we&#8217;ve hidden these elements behind the button. They&#8217;re there, you just can&#8217;t see them yet!</p>
<h3>Hover and Active Styles</h3>
<p>What we want to do next is take the wings that we just created and move them outward when the user hovers over the button. To accomplish this, we simply need to adjust the margins on each paragraph. Here we target each of the classes that we created, then move the .top one up and the .bottom one down. The .top class also required a slight line-height adjustment to look right. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span><span style="color: #3333ff;">:hover </span>.<span style="color: #000000; font-weight: bold;">top</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-80px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">35px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.button</span><span style="color: #3333ff;">:hover </span>.<span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-10px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>While we&#8217;re here, we might as well throw some active styles on as well. These will take effect during a mouse down event.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*Adjust Gradient*/</span>
<span style="color: #6666ff;">.button</span> a<span style="color: #3333ff;">:active </span><span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#00b7ea</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Old browsers */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#00b7ea</span> <span style="color: #933;">36%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#009ec3</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* FF3.6+ */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">36%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#00b7ea</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">100%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#009ec3</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome,Safari4+ */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#00b7ea</span> <span style="color: #933;">36%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#009ec3</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome10+,Safari5.1+ */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -o-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#00b7ea</span> <span style="color: #933;">36%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#009ec3</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Opera 11.10+ */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -ms-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#00b7ea</span> <span style="color: #933;">36%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#009ec3</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE10+ */</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#00b7ea</span> <span style="color: #933;">36%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#009ec3</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* W3C */</span>
filter<span style="color: #00AA00;">:</span> progid<span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span>.gradient<span style="color: #00AA00;">&#40;</span> startColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#00b7ea'</span><span style="color: #00AA00;">,</span> endColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#009ec3'</span><span style="color: #00AA00;">,</span>GradientType<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE6-9 */</span>
&nbsp;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*Pulls in Wings*/</span>
<span style="color: #6666ff;">.button</span><span style="color: #3333ff;">:active </span>.<span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-20px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.button</span><span style="color: #3333ff;">:active </span>.<span style="color: #000000; font-weight: bold;">top</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-70px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>As you can see, what I&#8217;ve done here is adjust the gradient so that the top color stretches a little farther, then I brought the wings back in a little bit so that there&#8217;s a contracting effect when you click. </p>
<p>Now our button is looking awesome. All three of our states are working. When you&#8217;re not hovering, it looks like a plain old button. When you are hovering, the wings or drawers pop out. When you click, the wings come in a little and the gradient changes ever so slightly. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/anim-download-6.jpg" alt="screenshot" width="510"/></div>
<h2>Final Step: Add The Transition</h2>
<p>At this point, everything appears to be working just fine. The only problem is that the hover effect takes place instantly and of course we&#8217;d like it to be a little more gradual. To accomplish this, go back to your paragraph block and add in a basic 0.5 second transition using all of the required prefixes.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">180px</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-50px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*TYPE*/</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span>/<span style="color: #933;">45px</span> Helvetica<span style="color: #00AA00;">,</span> Verdana<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*POSITION*/</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> -<span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*CSS3*/</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
     -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
          border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
&nbsp;
  -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
     -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
          box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.2</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
&nbsp;
  -webkit-transition<span style="color: #00AA00;">:</span> all 0.5s ease<span style="color: #00AA00;">;</span>
     -moz-transition<span style="color: #00AA00;">:</span> all 0.5s ease<span style="color: #00AA00;">;</span>
       -o-transition<span style="color: #00AA00;">:</span> all 0.5s ease<span style="color: #00AA00;">;</span>
      -ms-transition<span style="color: #00AA00;">:</span> all 0.5s ease<span style="color: #00AA00;">;</span>
          transition<span style="color: #00AA00;">:</span> all 0.5s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>With this addition, the button will transition very nicely between the three different states.</p>
<h2>See It In Action</h2>
<p>We&#8217;re all finished! You should now have an awesome animated CSS download button that is sure to impress. Check out the live demo below or <a href="http://tinkerbin.com/QfFHOSIL">check out the code on Tinkerbin</a>.</p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/animatedDownload/index.html">Click Here to Launch</a></p>
<div class="tutorialimage"><a href="http://designshack.net/tutorialexamples/animatedDownload/index.html"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/anim-download-6.jpg" alt="screenshot" width="510"/></a></div>
<p>Want an even better version of the button with six different versions to choose from? Check out the awesome free download at our new sister site <a href="http://designcurate.com/resource/animated-download-button">Design Curate</a>.</p>
<h2>Conclusion</h2>
<p>Thanks for reading and following along. If you made it all the way through, pat yourself on the back for a job well done. </p>
<p>I hope you learned a thing or two about z-index or cool CSS3 tricks. If not, at least you got an awesome button out of the deal! Leave a comment below and let us know if you enjoyed the tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/downloadbutton/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Jumpstart Your Web Project With HTML KickStart</title>
		<link>http://designshack.net/articles/css/htmlkickstart/</link>
		<comments>http://designshack.net/articles/css/htmlkickstart/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 18:02:52 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=28824</guid>
		<description><![CDATA[Recently, we took a look at a really solid framework from the good folks at Twitter called Bootstrap. This toolkit is a swiss army knife of utilities and includes both a functional layout grid and enough pre-styled elements to get a great jumpstart on any project. Today we&#8217;re going to look at a very similar [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-0.jpg" alt="screenshot" width="510"/></div>
<p>Recently, we took a look at a really solid framework from the good folks at Twitter called <a href="http://designshack.net/articles/css/5-incredibly-useful-tools-built-into-twitter-bootstrap/">Bootstrap</a>. This toolkit is a swiss army knife of utilities and includes both a functional layout grid and enough pre-styled elements to get a great jumpstart on any project.</p>
<p>Today we&#8217;re going to look at a very similar tool from Joshua Gatcke called <a href="http://www.99lime.com/">HTML KickStart</a>. This framework is simply overflowing with great stuff that will enable you to build web page prototypes at light speed. Let&#8217;s jump in and build a page with it to see what we think.</p>
<p><span id="more-28824"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>What We&#8217;re Building</h2>
<p>Before we jump into what HTML KickStart is and how you can use it, here&#8217;s a sneak peek at the final result of today&#8217;s tutorial:</p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/htmlkickstart/index.html">Click Here</a> to launch.</p>
<div class="tutorialimage"><a href="http://designshack.net/tutorialexamples/htmlkickstart/index.html"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-14.jpg" alt="screenshot" width="510"/></a></div>
<h2>What Is HTML KickStart?</h2>
<div class="tutorialimage"><a href="http://www.99lime.com/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-1.jpg" alt="screenshot" width="510"/></a></div>
<p>According to <a href="http://www.99lime.com/">99Lime.com</a> (the project&#8217;s homepage), HTML KickStart is &#8220;an ultra–lean set of HTML5, CSS, and jQuery (javascript) files, layouts, and elements designed to give you a headstart and save you 10&#8242;s of hours on your next web project.&#8221;</p>
<p>According to this statement, this project could theoretically save us one or even multiple full days of work. That&#8217;s certainly no small promise! How does it make good on such a claim? By providing a huge set of features. Don&#8217;t bother asking &#8220;what&#8217;s in HTML KickStart?&#8221; Instead ask, &#8220;what&#8217;s <em>not</em> in HTML KickStart?&#8221; The answer is of course, &#8220;not much.&#8221;</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-2.jpg" alt="screenshot" width="510"/></div>
<h2>Getting Started: Nav Menu</h2>
<p>To see how all of this works, we&#8217;re going to rough out a quick project. If you want to follow along, download the project and start with the sample HTML page, just be sure to strip out any placeholder elements so you have a fresh blank slate. </p>
<p>The first thing we&#8217;re going to do is add a topside navigation. If we swing by the HTML KickStart <a href="http://www.99lime.com/elements/">elements page</a>, we&#8217;ll find three built in menu options to choose from. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-3.jpg" alt="screenshot" width="510"/></div>
<p>We want the Horizontal Menu option so we click on the &#8220;Horizontal&#8221; tab and find some sample code that we can use for our own purposes.</p>
<p>The system here is really straightforward, you simply create an unordered list with the &#8220;menu&#8221; class and each list item will become a menu item. The class &#8220;current&#8221; is added to the current page and sub lists can be used to create drop down menus. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Menu Horizontal --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;menu&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;current&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>Home<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>About<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>Services<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>Web Design<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>Web Development<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>E-Commerce<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>Personal Portfolio<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>Publishing<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>UX Consulting<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>Contact<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>With only this little bit of HTML and zero CSS work, our menu looks great and is perfectly functional. As with the CSS, the JavaScript magic is already being taken care of for us.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-4.jpg" alt="screenshot" width="510"/></div>
<p>Notice that there&#8217;s already a background image applied to our body. This is the default grid image that comes with the framework, we&#8217;ll see how to swap this out later. </p>
<h2>Welcome Message</h2>
<p>Next we want to add a nice big headline to our page to welcome any visitors. This will make use of the pre-built typography styles.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;headline&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Welcome to a Design Shack Demo<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>This is a demo of HTMLKickStart, a rapid prototyping tool from <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.99lime.com/elements/&quot;</span>&gt;</span>99Lime.com<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- END WELCOME --&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>The h1 and p tags will already contain some default styling, but there&#8217;s nothing at this point governing our layout so we&#8217;ll need to help this out with some custom CSS.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-5.jpg" alt="screenshot" width="510"/></div>
<p>To start, we&#8217;ll want to center that text in the window. The paragraph and header also have a huge margin between them so we&#8217;ll need to tighten that up. Go into the &#8220;style.css&#8221; file and start a new section with your own styles. Then insert this code:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.headline</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.headline</span> h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.headline</span> p <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>With that, our headline is looking great. It&#8217;s perfectly centered has a greatly reduced vertical height. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-6.jpg" alt="screenshot" width="510"/></div>
<h2>Using the Grid</h2>
<p>We haven&#8217;t really needed it yet but HTML KickStart does come with a prebuilt layout grid. If you&#8217;ve ever used anything like 960.gs before, there won&#8217;t be any surprises here. It&#8217;s your basic 12 column grid that uses numbered classes (ex: col_5).</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-7.jpg" alt="screenshot" width="510"/></div>
<p>As you can see, to get the full width, you need the total of your column class numbers to add up to 12. So if you want to split the page in half, you&#8217;ll create two divs, each of which have the class &#8220;col_6&#8243; (6 + 6 = 12). You can do this with any combination that adds up to 12: col_7 + col_5, col_2 + col_10, etc. </p>
<p>To test this, we&#8217;ll do what I always do to test a grid system, code a basic three column layout. The CSS for this is already in place so busting out a three column layout is as easy as creating three divs, each with the &#8220;col_4&#8243; class. </p>
<p>In each div we&#8217;ll toss three elements: a headline (h3), paragraph and an image. Placeholder images are grabbed via the <a href="http://placehold.it/">placehold.it</a> service.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;col_4&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>Column One<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Lorem ipsum dolor sit amet...<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://placehold.it/284x100/4D99E0/ffffff.png&amp;text=284 x 100&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;284&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;col_4&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>Column Two<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Lorem ipsum dolor sit amet...<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://placehold.it/284x100/4D99E0/ffffff.png&amp;text=284 x 100&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;284&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;col_4&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>Column Three<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Lorem ipsum dolor sit amet...<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://placehold.it/284x100/4D99E0/ffffff.png&amp;text=284 x 100&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;284&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now we have a nice three column section under our headline. How easy was that?</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-8.jpg" alt="screenshot" width="510"/></div>
<h3>A Little Cleanup</h3>
<p>Looking at the example up to this point, I think the content is pushing up a little to close to the edge for my liking. To fix this, I wrapped everything after the menu into a &#8220;col_12&#8243; div. The difference is subtle, but it feels much better from a whitespace perspective. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-9.jpg" alt="screenshot" width="510"/></div>
<h3>Changing the Background</h3>
<p>While we&#8217;re tweaking things, let&#8217;s go in and swap out that background graphic. You&#8217;ll find this in the style.css file under the layout section.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*---------------------------------
	LAYOUT
-----------------------------------*/</span>
body<span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#efefef</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">css/img/grid.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">repeat</span> <span style="color: #993333;">center</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span><span style="color: #993333;">normal</span> <span style="color: #933;">0.9em</span>/<span style="color: #933;">150%</span> <span style="color: #ff0000;">'Arimo'</span><span style="color: #00AA00;">,</span> <span style="color: #ff0000;">&quot;Trebuchet MS&quot;</span><span style="color: #00AA00;">,</span> arial<span style="color: #00AA00;">,</span> verdana<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-shadow</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span> <span style="color: #933;">1px</span> <span style="color: #993333;">transparent</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* google font pixelation fix */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>All you have to do is replace the &#8220;grid.png&#8221; image with your own background pattern. I grabbed <a href="http://subtlepatterns.com/?p=1024">this one</a> and dropped it in just to give our page some contrast.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-10.jpg" alt="screenshot" width="510"/></div>
<h2>Slideshows and Buttons</h2>
<p>We&#8217;ve still barely scraped the surface of the great elements that are available in this framework. Let&#8217;s bust out a quick new section that utilizes some more features.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;headline col_12&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Here's Another Section<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>This time we'll be utilizing a slideshow and a button.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- END SECONDARY HEADLINE --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;col_8&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!-- Slideshow --&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slideshow&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;350&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://placehold.it/550x350/4D99E0/ffffff.png&amp;text=550x350&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;350&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://placehold.it/550x350/75CC00/ffffff.png&amp;text=550x350&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;350&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://placehold.it/550x350/E49800/ffffff.png&amp;text=550x350&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;600&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;350&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- END SLIDESHOW --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;col_4&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>A Slideshow!<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Lorem ipsum dolor sit amet...<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">button</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;blue&quot;</span>&gt;</span>A Sample Button<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">button</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- END SLIDESHOW PARAGRAPH --&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>Let&#8217;s walk through this piece by piece. First, we started with a headline exactly like the last one that we used. We reused our headline class from before so we shouldn&#8217;t need anymore custom CSS.</p>
<p>Next up, we used the awesome HTML KickStart Slideshow feature. This is implemented in a very similar way to the menu that we started with. Just toss in an unordered list with the class set to &#8220;slideshow&#8221;, define your height and width, then drop in some list items. Each list item will then become a slide. You can put anything you want inside of slides: text, images, etc.</p>
<p>Just like with the menu, this slideshow will automatically be functional as long as you&#8217;ve included the requisite JavaScript files that come with the download. This is an important feature, Twitter&#8217;s bootstrap requires some extra hoop jumping to get the JavaScript up and running but it&#8217;s truly effortless with HTML KickStart.</p>
<h3>Buttons</h3>
<p>Notice that the slideshow is in a &#8220;col_8&#8243; div, which means we need a &#8220;col_4&#8243; div for the next part, which is just a simple paragraph referencing the slideshow.</p>
<p>In this paragraph you&#8217;ll notice that I used a simple &#8220;button&#8221; element with a class of &#8220;blue&#8221;. There are all kinds of pre-built buttons to choose from: plain and gray, colored, you can even add icons! </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-11.jpg" alt="screenshot" width="510"/></div>
<p>I chose to go with the simple blue for this button but it&#8217;s just as easy to use any of the others. Drop in the code from the examples on the site and you&#8217;re good to go. </p>
<p>Here&#8217;s a shot of what this section looks like. Once again, without a single bit of extra CSS or JavaScript we were able to accomplish some impressive feats!</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-12.jpg" alt="screenshot" width="510"/></div>
<h2>Footer</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-13.jpg" alt="screenshot" width="510"/></div>
<p>Included in your sample files is an example of a footer. This is important because it shows you how to break out of the grid and establish a full width colored area, something that I struggled with in my own attempts before noticing the footer. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clear&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;footer&quot;</span>&gt;</span>
This page was built with <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.99lime.com&quot;</span>&gt;</span>HTML KickStart<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span> for <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://designshack.net/&quot;</span>&gt;</span>Design Shack<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>.
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;link-top&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#top-of-page&quot;</span>&gt;</span>Top<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p>Here it uses an ugly, non-semantic div to clear the floats, but this is a fairly common practice and really isn&#8217;t the end of the world so don&#8217;t get too caught up with it. </p>
<p>To style the footer div, some padding and color was applied and the little link to the top of the page was prettied up a bit. This transition is animated via some more fancy built-in JavaScript. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#footer</span><span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#efefef</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">border-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">0.8em</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-shadow</span><span style="color: #00AA00;">:</span><span style="color: #933;">0px</span> <span style="color: #933;">1px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#link-</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> inline-<span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#e5e5e5</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
	-moz-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
	-webkit-border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
	border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h2>Final Product</h2>
<p>We could keep going for days with all of the stuff that&#8217;s in this toolkit. You&#8217;ll also find pre-styled tables, forms, image galleries, breadcrumbs, tabs, horizontal rules and even pre code snippets. </p>
<p>With what we&#8217;ve gone through, you get the basic idea for how it all works. The documentation is very thorough so all you really have to do is find the item you want to insert, then paste the code into your HTML and tweak as needed. Here&#8217;s another look at the page we just built:</p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/htmlkickstart/index.html">Click Here</a> to launch.</p>
<div class="tutorialimage"><a href="http://designshack.net/tutorialexamples/htmlkickstart/index.html"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/htmlkickstart-14.jpg" alt="screenshot" width="510"/></a></div>
<h2>Who Is This For?</h2>
<p>Now that we&#8217;ve seen <em>how</em> to use HTML KickStart, it&#8217;s important to discuss <em>why</em> you would use it. Perhaps even more relevant is who should think about giving this a shot.</p>
<p>Like most fully featured frameworks and boilerplates, HTML KickStart provides you with a really solid starting point for your development projects, not only from an HTML standpoint, but for CSS and even JavaScript as well. You should think about giving it a look if you don&#8217;t currently have a system in place that makes starting new projects easy.  </p>
<div class="pullquote-r">
&#8220;The real strength in these types of toolkits is rapid prototyping&#8221;
</div>
<p></ br></p>
<p>Keep in mind that there&#8217;s a lot in this toolkit, too much for many developers&#8217; taste. You can pick and choose what you want and leave out the rest, but also consider that the real strength in these types of toolkits is rapid prototyping. In a finished product, you may want to take the time to work out a layout scheme and all these bits of styling manually, but in the initial concept stages, why not upgrade your non-functioning wireframes to something like what we built today? It&#8217;s much more interactive than a flat sketch and really doesn&#8217;t take much more time to bust out. </p>
<h2>Is It Any Good?</h2>
<p>To be sure, this is not the only product of its kind on the market. There are a million different free frameworks out there, each with their own degree of custom styling. As I mentioned above, the closest thing I&#8217;ve seen to HTML KickStart is Twitter&#8217;s Bootstrap. In fact, the two projects are nearly identical at a glance. </p>
<p>Having tried both, there&#8217;s definitely a lot that I like about Bootstrap better. For starters, the layout is a little tighter and the docs go through advanced features like offsetting columns. I also like Bootstrap&#8217;s typography styles better and really appreciate the LESS integration.</p>
<p>That being said, there are some things that I like about HTML KickStart that you won&#8217;t find in Bootstrap. For instance, the slideshow feature is a huge bonus and something that I would genuinely use quite a bit. Further, all of the JavaScript in HTML KickStart &#8220;just works&#8221; while I had to do a lot of fiddling to get things working in Bootstrap.</p>
<p>Ultimately, I recommend that you give both a quick test drive to see which you like better. Even better, use both as inspiration for developing your own personal framework that&#8217;s custom-tailored to your needs.</p>
<h2>Conclusion</h2>
<p>HTML KickStart is an awesome project and I truly appreciate all the handwork that&#8217;s been put into it. When members of the development community distribute projects like this freely, I&#8217;m always amazed by their generosity and willingness to help others.</p>
<p>By now you should have a solid understanding of what HTML KickStart is, what it does, how to use it and whether or not it&#8217;s right for you. Leave a comment below and let us know what you think. How does this project compare to other similar toolkits that you&#8217;ve used?</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/htmlkickstart/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Nailing Browser Support in CSS3 and HTML5: Invaluable Resources to Use Today</title>
		<link>http://designshack.net/articles/css/nailing-browser-support-in-css3-and-html5-invaluable-resources-to-use-today/</link>
		<comments>http://designshack.net/articles/css/nailing-browser-support-in-css3-and-html5-invaluable-resources-to-use-today/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 17:23:23 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[compatibility]]></category>
		<category><![CDATA[cross browser]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=28778</guid>
		<description><![CDATA[New technologies are making web development more exciting than ever before. HTML5 and CSS3 provide a double dose of modern practices that are absolutely refreshing and empowering. Unfortunately, utilizing these technologies can considerably complicate your quest for cross browser compatibility. How can you know which techniques are safe to use now and which you should [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-0.jpg" alt="screenshot" width="510"/></div>
<p>New technologies are making web development more exciting than ever before. HTML5 and CSS3 provide a double dose of modern practices that are absolutely refreshing and empowering. Unfortunately, utilizing these technologies can considerably complicate your quest for cross browser compatibility. </p>
<p>How can you know which techniques are safe to use now and which you should either provide alternatives to or avoid altogether? Join us as we take a look at a handful of our favorite resources that quickly and easily help you make informed decisions about real world HTML5 and CSS3 implementation. </p>
<p><span id="more-28778"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>Simply Irresistible</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-10.jpg" alt="screenshot" width="510"/></div>
<p>Cross browser compatibility was difficult enough a few years ago before we started diving into fancy new technologies like HTML5 and CSS3. Now with these tools creeping to the forefront of our development methods, it can be a downright mess.</p>
<p>The benefits of using HTML5 and CSS3 are clear and undeniable. They&#8217;re so full of goodies and fun that nary one in ten developers can resist at least dipping a toe in to test the waters. To further the hype, authors like me are constantly dishing out awesome new tutorials that teach you the ins and outs of these technologies, thereby fueling your desire to put them into practice as soon as possible. </p>
<h2>Are We Rushing Ahead?</h2>
<p>While most of us are rushing headlong into utilizing the latest and greatest in web development trends, a few more rational souls are begging us to slow down. New toys are all well and good but much of this stuff is still under construction and the rest hasn&#8217;t been implemented well across all of the important browsers. </p>
<p>So who is right? How can you as a practical, real world developer know whether to buy into the hype and run with the new or trust the skeptics and stick with the tried and true methods from years past? </p>
<h2>Stop the Guesswork</h2>
<p>The single best thing that you can do to decide whether you can personally begin to implement new web technologies is to educate yourself on the support that you can expect for each new item in the various browsers that matter most to your audience. </p>
<p>This sounds like a lot of work doesn&#8217;t it? There are countless blogposts, books and websites dedicated to teaching you this stuff, enough to eat up an entire lifetime and more. The amount of material is so completely overwhelming that you might avoid learning simply out of intimidation.</p>
<p>Fortunately, there are some very easy and straightforward ways to make sure that what you&#8217;re doing will work well across various browsers. You won&#8217;t have to sort through mile long blog posts or read a stack of books every time you want to toss in a drop shadow, you&#8217;ll just need a quick look at a few select resources to get you going. </p>
<h2>Browser Compatibility Charts: A Developer&#8217;s Best Friend</h2>
<p>The very first thing that I recommend that you do in your quest to figure out which new technologies you can implement today is to bookmark one or two solid browser compatibility charts. </p>
<p>These resources are invaluable and can save you endless hours of research. They serve as a quick reference that immediately helps you identify which browsers do and don&#8217;t support the techniques that you&#8217;re trying to implement. Some of the better choices even offer help getting the older browsers to play nice. </p>
<h3><a href="http://caniuse.com/">When can I use&#8230;</a></h3>
<p><a href="http://caniuse.com/">Caniuse.com</a> is certainly not the prettiest option available for browser compatibility charts, but it is one of the most helpful and thorough.</p>
<div class="tutorialimage"><a href="http://caniuse.com/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-1.jpg" alt="screenshot" width="510"/></a></div>
<p>The organization here is very simple and easy to use: just click an item from any of the five categories (CSS, HTML5, SVG, JS API and Other) and you&#8217;ll be taken to a chart showing you the support for various browsers. Also, the search provides <em>instant results</em> as you type so answers to all your browser questions are never more than a few keystrokes away.</p>
<p>For instance, let&#8217;s say you read my <a href="http://designshack.net/articles/css/the-lowdown-on-before-and-after-in-css/">recent article on :before and :after</a> and would like to double check my statements about browser compatibility for the :after pseudo element (always double check your facts!), all you have to do is type &#8220;after&#8221; into the search bar and the chart below will pop up. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-2.jpg" alt="screenshot" width="510"/></div>
<p>There&#8217;s a ton of great information here for you to utilize. The chart informs us that we&#8217;ve got great support across the board for current browsers (even IE), but run into some trouble two versions back with IE7 and before. </p>
<p>In addition to the compatibility chart, you&#8217;ll find two other valuable items: a browser comparison feature and a list of helpful resources. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-3.jpg" alt="screenshot" width="510"/></div>
<p>The latter of these often includes some really great links. For instance, if you&#8217;re looking up new CSS3 functionality such as gradients, you might get a link for a generator that will do the work for you. In the case above we received a link for a detailed guide explaining the use of CSS generated content using pseudo elements. </p>
<p>The browser compatibility chart allows you to choose two browsers and see an overview of the support for the items in any of the five categories mentioned before.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-4.jpg" alt="screenshot" width="510"/></div>
<h3><a href="http://www.findmebyip.com/litmus/">FindMeByIP</a></h3>
<p>If you&#8217;re looking to forgo all of the features of the previous site in favor of some plain old extensive browser compatibility charts that you can bookmark and reference in a flash, check out the <a href="http://www.findmebyip.com/litmus/">HTML5 &#038; CSS3 Support page</a> at FindMeByIP. </p>
<div class="tutorialimage"><a href="http://www.findmebyip.com/litmus/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-5.jpg" alt="screenshot" width="510"/></a></div>
<p>As you can see, the charts here are quite attractive and very easy to read. These are perfect for when you just need to quickly double check something or get an overview of browser support across the board. </p>
<h2>Should You Use It?</h2>
<p>Browser compatibility charts are awesome for letting you know whether or not a given browser supports what you&#8217;re trying to implement, but they only empower you to make decisions, you still have to interpret the information and decide whether or not it&#8217;s safe to proceed.</p>
<p>If you&#8217;re a new developer, this can be intimidating. To help you out further, be sure to check out <a href="http://html5please.us/">HTML5 Please</a>. This community sourced project  flat out tells you whether or not to use a given technique and makes recommendations for how to proceed. You should never follow something blindly, but when you&#8217;re on the fence this can sure help you make the call.</p>
<div class="tutorialimage"><a href="http://html5please.us/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-6.jpg" alt="screenshot" width="510"/></a></div>
<p>As with <em>When Can I Use</em>, the search bar here provides instant results as you type. Let&#8217;s say you want to know whether or not CSS transitions are safe to implement, simply enter &#8220;transitions&#8221; and the results will filter to the following:</p>
<div class="tutorialimage"><a href="http://html5please.us/#transitions"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-7.jpg" alt="screenshot" width="510"/></a></div>
<p>Right away we get a recommendation for use, shown in the top right corner of the result:</p>
<div class="tutorialimage"><a href="http://html5please.us/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-8.jpg" alt="screenshot" width="510"/></a></div>
<p>&#8220;Use with fallback&#8221; is the advice we are given for CSS transitions. This is coupled with some brief and straightforward information that tells us that transitions are safe if they&#8217;re not necessary for a usable experience and that any interaction critical transitions should be backed up with an alternative for other browsers. The necessary browser prefixes for implementation are also provided. For many items, recommended polyfills are provided to help make your implementation as cross browser compatible as possible. </p>
<h2><a href="http://www.modernizr.com/">Modernizr</a> Has Your Back</h2>
<p>The final resource you need to become familiar with in your quest for cross browser compatible CSS3 and HTML5 is <a href="http://www.modernizr.com/">Modernizr</a>. You&#8217;ve no doubt heard of it before, but it&#8217;s time to download it and check it out. </p>
<div class="tutorialimage"><a href="http://www.modernizr.com/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/compatibilitybuffer-9.jpg" alt="screenshot" width="510"/></a></div>
<p>The reason that Modernizr is so great is that it can automatically detect whether or not a browser supports a given feature and then serve up some JavaScript magic in response. This allows you to account for an impressively wide array of circumstances and provide JavaScript fallbacks and polyfills for older browsers with very little effort. </p>
<p>Modernizr will test for support for over 40 next-gen features, provide on the go information to tell you what will and won&#8217;t be supported and provides the best solutions around to help you respond to any holes in support.  </p>
<h2>Conclusion</h2>
<p>The resources above are all aimed at helping you make informed decisions about whether or not to implement a given HTML5 or CSS3 technique.</p>
<p>Browser compatibility charts provide a quick reference to how you can expect each browser to respond to a given technique, HTML5 Please will give you solid and honest recommendations for whether or not to proceed, and Modernizr will help you identify and fill the functionality gaps in a specific design. </p>
<p>These resources don&#8217;t get you off the hook for <a href="http://movethewebforward.org/">diving into deeper understanding</a> of how to properly implement these features, but they do serve as an awesome starting guide for how and when to proceed. </p>
<p>Leave a comment below and tell us about your favorite resources in this area. Do you use any of the sites listed above? What other tools are invaluable to your workflow?</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/nailing-browser-support-in-css3-and-html5-invaluable-resources-to-use-today/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create Amazing CSS Buttons on the Fly With CSSButton.Me</title>
		<link>http://designshack.net/articles/css/create-amazing-css-buttons-on-the-fly-with-cssbutton-me/</link>
		<comments>http://designshack.net/articles/css/create-amazing-css-buttons-on-the-fly-with-cssbutton-me/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 06:00:15 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=28690</guid>
		<description><![CDATA[Today we&#8217;re going to have some fun as we take a look at an awesome new free tool for web developers simply called CSS Button. This web app makes it quick and easy to make the CSS buttons of your dreams using simple and intuitive controls. I&#8217;ve seen quite a few other CSS button makers [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-0.jpg" alt="screenshot" width="510"/></div>
<p>Today we&#8217;re going to have some fun as we take a look at an awesome new free tool for web developers simply called <a href="http://www.cssbutton.me/">CSS Button</a>. This web app makes it quick and easy to make the CSS buttons of your dreams using simple and intuitive controls.</p>
<p>I&#8217;ve seen quite a few other CSS button makers before and almost none really merit repeated use, but this site has a lot going for it and can genuinely save you a lot of time and frustration. Let&#8217;s jump in and check it out!</p>
<p><span id="more-28690"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>Meet CSS Button</h2>
<div class="tutorialimage"><a href="http://www.cssbutton.me/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-1.jpg" alt="screenshot" width="510"/></a></div>
<p>The <a href="http://www.cssbutton.me/">CSS Button app</a> is great for jumpstarting your buttons. To start off, there are a few things on the home page that you don&#8217;t want to miss. The basic controls are fairly obvious, you can start a new button from scratch, check out and modify a template or hook up with Twitter so that you can save your work. </p>
<p>Also, don&#8217;t miss the somewhat hidden &#8220;Random Button&#8221; feature in the footer. There isn&#8217;t too much content on the site at the moment (the app is still in beta) but as it picks up and gains more users, this feature will become a fun way to discover new button ideas. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-2.jpg" alt="screenshot" width="510"/></div>
<h2>Creating a Button From Scratch</h2>
<p>I&#8217;m never one to opt for the easy way out, so let&#8217;s start by building our own button completely from scratch. To do this, just hit the link on the left:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-3.jpg" alt="screenshot" width="510"/></div>
<p>This should take you to a new screen where you will have all of the controls that you need to create a super fancy button. All of the inputs are basic and use either simple forms or intuitive WYSISYG controls. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-4.jpg" alt="screenshot" width="510"/></div>
<p>We&#8217;ll go through each step to show you how the process works. Keep in mind that this may feel fairly involved in a written layout, but once you try it for yourself the effort really feels minimal. </p>
<h3>Background Gradient</h3>
<p>The first step we&#8217;re going to take is to define a background for our button. You can either choose a solid color or a gradient, I&#8217;ll take the gradient route. This uses simple color selectors to help you build your gradient. If you&#8217;ve ever coded CSS gradients by hand, then you know that we&#8217;re already saving ourselves a big chunk of time because choosing two colors is far easier than writing the mess of code necessary to perform this operation.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-5.jpg" alt="screenshot" width="510"/></div>
<p>Clicking the lightning bolt next to an option brings out its list of controls. For many of these, you can click multiple times to add the effect a number of times. This helps create really complex, Photoshop-like layers.</p>
<h3>Understanding the Preview</h3>
<p>Off to the right of the button controls is the preview of what you&#8217;re creating. It doesn&#8217;t look like much at this point but it will get much better as we progress.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-6.jpg" alt="screenshot" width="510"/></div>
<p>Notice that they&#8217;ve covered all the bases here and allow you to style the normal, hover and active states. By default, our actions will affect the normal state, we simply click on one of the other states to target it specifically. The &#8220;Final&#8221; version is a live button that you can use to evaluate and interact with your design.</p>
<h3>Box-Shadow</h3>
<p>Next up are the box-shadow controls. These are simple enough and allow you to quickly enter values for the offset, blur, spread, etc. You then choose your color and can even toggle the inset option for inner shadows. My one disappointment here is that it doesn&#8217;t look like you can set the shadow using an rbga value, which is my preferred method so that the background shows through. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-7.jpg" alt="screenshot" width="510"/></div>
<h3>Button Dimensions</h3>
<p>Now it&#8217;s time to finally give our button some substance. In this section you can set a static size and add in margins/padding to add weight to your button. You can also round the corners off with some border radius. Each of these options lets you be as specific as you want, so for example you can either choose to set the border margin to be the the same on all sides or different for each corner.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-8.jpg" alt="screenshot" width="510"/></div>
<p>After this step, we can see that our button is looking much more like, well, a button!</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-9.jpg" alt="screenshot" width="510"/></div>
<h3>Font Properties</h3>
<p>Next up we have some controls for setting our text and text shadow styles. I really appreciate being able to set not just the font, but the font stack. This shows that the developer had coders in mind when building this tool. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-10.jpg" alt="screenshot" width="510"/></div>
<p>After this step, our button is looking pretty sharp. We&#8217;ve set just about everything that we need to for a basic button (you can also go in and set a transition if you wish).</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-11.jpg" alt="screenshot" width="510"/></div>
<h3>Hover and Active</h3>
<p>After getting my normal button state exactly how I want it, it&#8217;s time to go back and add in the settings for my hover and active states. I took the predictable route of making the button a little lighter on hover and reversing the gradient to simulate a press on active. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-12.jpg" alt="screenshot" width="510"/></div>
<p>Once we&#8217;re done, we get a nice fat chunk of CSS to place in our code. It&#8217;s a big chunk of code but it&#8217;s all my own doing and mostly results from all of those crazy browser prefixes that you have to use to pull off gradients and shadows. As I look at all of the code necessary for this simple button, it becomes quite evident just how much time this little tool saved me. I&#8217;m more than capable of creating this button by hand but it would admittedly take me several minutes, I was much quicker using the WYSIWYG controls here.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-13.jpg" alt="screenshot" width="510"/></div>
<h2>Starting From a Template</h2>
<p>Now that we&#8217;ve gone the DIY route, let&#8217;s go back to the beginning and take the other option: start from a template. Clicking that link takes you to the <a href="http://www.cssbutton.me/templates/">templates page</a> where there are currently five super slick button examples to choose from.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-14.jpg" alt="screenshot" width="510"/></div>
<h3>Modifying the Template</h3>
<p>To begin, I chose to start from the &#8220;Sexy Green Download Button&#8221; template. Choosing an option takes you into the same generator that we saw before, the only difference is that it&#8217;s now pre-populated with the appropriate settings to create the button below.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-15.jpg" alt="screenshot" width="510"/></div>
<p>It&#8217;s really nice to have that solid base built up already, from here it&#8217;s just a matter of customizing the values that you&#8217;d like to change. For instance, starting with the button above, I went in and changed only the border-radius and box-shadow properties and was able to quickly bust out my own unique faux 3D button.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/cssbuttonapp-16.jpg" alt="screenshot" width="510"/></div>
<h2>Worth a Try?</h2>
<p>I know what many of you are thinking, and I&#8217;m with you. I&#8217;m a total nerd who loves both the art and science of CSS so I actually <em>enjoy</em> coding these types of things by hand. That being said, I can&#8217;t help but appreciate a utility that can genuinely save me time, and this is one of those tools. Beyond that, I don&#8217;t always know what I want in a button when I start creating it and its nice to have some visual tools to experiment with and tweak until I find something that I like.</p>
<p>CSS Button is still in beta so I did run across a bug or two. For instance, when you type in a color by hand and then click on the color selector later to tweak it, you find that the color selector doesn&#8217;t update to reflect the manual entry. </p>
<p>Aside from a few very minor quirks though, this is a solid utility that I plan on adding to my ever growing CSS3 toolbox. As I mentioned above, there&#8217;s a lot about this app that makes it evident that it was built with coders in mind. I have an impressive amount of flexibility to do all the things that I would normally do by hand, they&#8217;re just in a format that&#8217;s a bit easier to follow. </p>
<p>What do you think? Do you enjoy tools that aim to help you perform complex tasks a little easier or do you prefer the purist route of only coding by hand?</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/create-amazing-css-buttons-on-the-fly-with-cssbutton-me/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Beating Borders: The Bane of Responsive Layout</title>
		<link>http://designshack.net/articles/css/beating-borders-the-bane-of-responsive-layout/</link>
		<comments>http://designshack.net/articles/css/beating-borders-the-bane-of-responsive-layout/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 06:00:47 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=28655</guid>
		<description><![CDATA[Responsive design often requires setting your widths using percentages. This is easy enough to accomplish, that is until you start throwing borders into the mix. If your columns and total width are set using percentages, a static border size wreaks havoc on your layout. Today we&#8217;re going to look at a couple of different ways [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/borderbad-0.jpg" alt="screenshot" width="510"/></div>
<p>Responsive design often requires setting your widths using percentages. This is easy enough to accomplish, that is until you start throwing borders into the mix. If your columns and total width are set using percentages, a static border size wreaks havoc on your layout.</p>
<p>Today we&#8217;re going to look at a couple of different ways to beat this problem. You&#8217;ll learn how to create a completely fluid layout that doesn&#8217;t mind extra borders or padding one bit. </p>
<p><span id="more-28655"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>Responsive Design Is Easy&#8230; In Theory</h2>
<p>Responsive design is currently our best answer for serving up optimized content to the wealth of different devices and screen sizes that access the web today. With a few basic media queries we can quickly and easily take a static design and turn it into something that evolves based on the user&#8217;s unique needs. How amazing is that?</p>
<div class="pullquote-r">
&#8220;Real world coding has a way of surprising you&#8221;
</div>
<p></ br></p>
<p>In theory, this looks nice and simple to me. I&#8217;ve spent a lot of time both reading and writing about responsive design, so I know both the theory and the practices well enough that I should never encounter any major hurdles. However, real world coding has a way of surprising you. No matter how prepared you think you are, when it comes time to actually bring your project to life, some major hurdles are bound to present themselves. Especially when you&#8217;re approaching complex layouts in CSS. </p>
<p>There are a million issues that arise in situations like this but today I want to focus on one that specifically threw me a curve ball: borders. When designing responsive layouts these seemingly innocent touches can have the effect of ruining everything!</p>
<h2>Responsive Math</h2>
<p>When coding a full on responsive site, one highly recommended practice is to use percentage based widths on your content. Sure, you can combine media queries with static widths, but then your layout isn&#8217;t nearly as adaptive as it could be. If that&#8217;s the ultimate goal, why not go all the way?</p>
<p>Combining multiple column layouts with percentage based widths involves a little bit of math, but it&#8217;s actually super basic and can be handled by anyone with basic addition and multiplication skills (we performed this next bit in our <a href="http://designshack.net/articles/css/how-to-build-a-responsive-thumbnail-gallery/">responsive thumbnail gallery tutorial</a>).</p>
<p>Let&#8217;s say we want a five column layout. The first thing I like to do is think about margins. If we want 4% margins between our columns, 4% times 5 columns equals 20% of our width being reserved for margins. Then we subtract 20% from the total width (100%) to come up with 80% left for the actual columns. 80% divided by five columns equals a 16% width on each column. Here&#8217;s a graphic to make everything a little clearer:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-1.jpg" alt="screenshot" width="510"/></div>
<p>Putting this math to good use in our CSS would look something like the following. Pretty easy right?</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.column</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">2%</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">2%</span><span style="color: #00AA00;">;</span>  <span style="color: #808080; font-style: italic;">/*2% right +2% left = 4% margin*/</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h2>The Border Problem</h2>
<p>Not so fast. Let&#8217;s say we want to add a border to our design. How do we do that? Normally we would simply add a border to the column class, but we&#8217;ve already accounted for 100% of the width in the layout above. Adding border completely screws up our layout. Here we have five columns distributed via the CSS above:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/borderbad-1.jpg" alt="screenshot" width="510"/></div>
<p>And here&#8217;s what happens when we add a border of say, 2px to a column:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/borderbad-2.jpg" alt="screenshot" width="510"/></div>
<p>The solution of course would be to account for the border in our previous math, but how do we go about this? It turns out, we can&#8217;t set the border size as a percent, only a static value. This is problematic because if we use percents for everything else, the amount of space that we leave for the border will be a varying value, meaning it will change as the page width changes. This makes it nigh upon impossible to decide on a width for our borders! So what do we do? Should we give up and scrap the border idea?</p>
<h2>CSS Outline to The Rescue</h2>
<p>Obviously, what we need is a way to apply a border to a column without screwing with its width. As any good CSS trickster knows, there is in fact a property that does just that: outline. Using the following code, we can leave our math exactly as we figured before and still come away a border-like effect that doesn&#8217;t break our layout.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.column</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">2%</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">2%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#03a8d2</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>This works great for our test, the columns flow nicely and fit perfectly in the space provided despite the outline:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/borderbad-3.jpg" alt="screenshot" width="510"/></div>
<h3>Headaches</h3>
<p>We found our solution, let&#8217;s pat ourselves on the back and call it a day! Unfortunately, there&#8217;s always a caveat. In this case, there are several.</p>
<p><strong>Browser Compatibility</strong><br />
The first issue that arises with using the CSS outline property is of course browser compatibility. To be fair, the situation here could be worse. We&#8217;ve got great support across the board in modern browsers: Safari, Chrome, Opera, even IE! Unfortunately, IE support only goes back to IE8 with IE6 and 7 having zero support.</p>
<p>Many developers have only recently decided that they can scrap IE6 support so I know many won&#8217;t be willing to do the same for IE7 just yet. However, the good news is that this is purely a subtle aesthetic touch and it&#8217;s definitely not going to ruin my day if everyone sees the outline except IE7 users. </p>
<p><strong>Firefox Box-Shadow Problem</strong><br />
Even though Firefox fully supports the CSS outline property, you have to be really careful how you use it. Specifically, you&#8217;ll run into problems if you combine an outline with a box-shadow. To see what I mean by this, here&#8217;s an outline and a box-shadow rendered in Safari (the good way):</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/borderbad-4.jpg" alt="screenshot" width="510"/></div>
<p>Now here&#8217;s the exact same code rendered in Firefox (the messed up way):</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/borderbad-5.jpg" alt="screenshot" width="510"/></div>
<p>As you can see, for some crazy reason, Firefox places the outline outside of the shadow rather than on the true edge of our column. This results in unacceptable ugliness!</p>
<p><strong>All Or Nothing</strong><br />
One final thing to remember about CSS outlines: you can&#8217;t apply them selectively. With borders, you can use border-right, border-top, etc. but with an outline you&#8217;re forced to accept the idea that it will be uniform all the way around the edge of your object. </p>
<h2>Another Solution: box-sizing</h2>
<p>The CSS outline has a lot of baggage! It solves our problem but comes with a pretty hefty set of instructions that you might not care for. If only there a way to use the far superior border property but adjust the CSS box model to our own devices. Well you&#8217;re in luck, because there is in fact just such a property: box-sizing. </p>
<p>This magical property allows us to tweak that ever confusing box model. The default value of box sizing is &#8220;content-box&#8221;, which is essentially the box model that we know and love. The width and height values determine the size of the content and any padding or borders are drawn outside of that and therefore add to the width. So a 200px wide div with a 2px border technically eats up 204px of space. </p>
<h3>border-box</h3>
<p>The other possible value for box-sizing is &#8220;border-box&#8221;, which actually places any padding and borders inside of the specified height and width. This means that a 200px wide div with a 2px border is still only 200px! Here&#8217;s what this looks like if we apply it to our columns:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.column</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">2%</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">2%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#03a8d2</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	-webkit-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
	-moz-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
	box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br> </p>
<p>With this code, our columns are flowing perfectly despite having borders applied:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/borderbad-3.jpg" alt="screenshot" width="510"/></div>
<p>We can even take this a step further and add some padding to the equation without screwing anything up. As long as you have the box-sizing property set to border-box, no additional math is necessary. Add all of the borders and padding that you like and everything still works:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.column</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">2%</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">2%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#03a8d2</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>
	-webkit-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
	-moz-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
	box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/borderbad-6.jpg" alt="screenshot" width="510"/></div>
<h3>Browser Compatibility</h3>
<p>Interestingly enough, browser compatibility here is the same as with outline, meaning this works on pretty much everything but IE6 and IE7. Your main concern here though is that, unlike with outline, the layout will in fact fail in browsers that don&#8217;t support this property.</p>
<h2>Which Method Is Best?</h2>
<p>The outline property is definitely the simpler fix, it works in a lot of situations and if it fails, nothing bad happens to your layout. However, I think that the box-sizing method just feels so much better. I can combine it with a shadow without any serious problems, browser support is actually not bad and I can still enjoy all the goodness of borders. The fact that padding can also be thrown into the mix is icing on the cake and brings this way ahead of the competition in my mind. If you&#8217;re worried about IE7, you can always whip up a quick conditional stylesheet that solves the problem. </p>
<h2>Demo</h2>
<p>If you want to see box-sizing in action, cruise over to Dabblet to see the <a href="http://dabblet.com/gist/1626972">live demo</a> of the example above.</p>
<div class="tutorialimage"><a href="http://dabblet.com/gist/1626972"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/borderbad-7.jpg" alt="screenshot" width="510"/></a></div>
<h2>Conclusion</h2>
<p>Outline and box-sizing represent two possible solutions to our problem of combining borders with percent based widths in CSS layouts. Neither solution is perfect, but as long as you know what you&#8217;re doing, both can be used to successfully solve your layout woes.</p>
<p>Now that you&#8217;ve seen my solutions for this problem, it&#8217;s time for you to chime in. How do you handle the problem of borders in responsive layouts? Do you have a different solution not listed above?</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/beating-borders-the-bane-of-responsive-layout/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Lowdown on :Before and :After in CSS</title>
		<link>http://designshack.net/articles/css/the-lowdown-on-before-and-after-in-css/</link>
		<comments>http://designshack.net/articles/css/the-lowdown-on-before-and-after-in-css/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 06:00:15 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=28516</guid>
		<description><![CDATA[We recently took a look at :active, an extremely handy pseudo-class selector that can be used to create some awesome mouse-down effects. Today we&#8217;re going to take a step back and explore some other &#8220;pseudo&#8221; items, this time we&#8217;ll be looking at the pseudo-elements :before and :after. You&#8217;re probably beginning to see these used all [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-beforeafter-0.jpg" alt="screenshot" width="510"/></div>
<p>We <a href="http://designshack.net/articles/css/css-active-tutorial/">recently took a look at :active</a>, an extremely handy pseudo-class selector that can be used to create some awesome mouse-down effects. Today we&#8217;re going to take a step back and explore some other &#8220;pseudo&#8221; items, this time we&#8217;ll be looking at the pseudo-elements :before and :after. You&#8217;re probably beginning to see these used all over the web in advanced CSS examples so you might as well jump in and learn to use them yourself.</p>
<p>What is a pseudo-element and how does it differ from a pseud-class? Why do pseudo-elements sometimes have one colon and sometimes have two? How are :before and :after implemented in CSS? What are some ways that developers all over the web are using these tools to perform amazing feats of modern coding? Read on to find out.</p>
<p><span id="more-28516"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>Pseudo-Classes vs. Pseudo-Elements</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-beforeafter-6.jpg" alt="screenshot" width="510"/></div>
<p>This is a super confusing little piece of semantics that lots of people seem to be mixed up about (myself included before diving into the research). If you run a quick Google search to find the difference between the two, you&#8217;ll find longwinded and overly technical responses mixed in with simple, uninformed statements that the two are in fact different, with no discussion as to how or why. Some sources, such as W3Schools, seem to use the terms interchangeably, which often results in incorrect usage. The answer though is pretty simple if you break it down.</p>
<h3>Pseudo-Classes: Target Whole Elements</h3>
<p>First, let&#8217;s look at pseudo-classes, which target complete elements or element states.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a<span style="color: #3333ff;">:link </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#111</span><span style="color: #00AA00;">&#125;</span>
a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">&#125;</span>
div<span style="color: #3333ff;">:first-child </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">&#125;</span>
div<span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#444</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>As you can see, though these conditions aren&#8217;t necessarily based on the DOM, the resulting selection is a complete element in every case. What is ultimately styled is an entire link element, paragraph, div, etc. </p>
<h3>Pseudo-Elements: Target Element Sub-Parts</h3>
<p>Pseudo-elements, on the other hand, select <em>sub-parts</em> of an element. This is an important distinction, here are some examples:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:first-line </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#555</span><span style="color: #00AA00;">&#125;</span>
p<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:first-letter </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">&#125;</span>
a<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">content</span> <span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;hello world&quot;</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>As you can see, all of these target only a part of an element: the first line or letter of a paragraph for instance. These also have the amazing ability to target and even add to things that aren&#8217;t even specified in your HTML, which is exactly what :before and :after, the topic of today&#8217;s discussion, do for us. </p>
<p>To read more about the differences between pseudo-classes and pseudo selectors, I highly recommend that you check out <a href="http://www.d.umn.edu/~lcarlson/csswork/selectors/pseudo_dif.html">UMD</a> for a nice and thorough explanation with plenty of examples.</p>
<h2>:before vs. ::before</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-beforeafter-7.jpg" alt="screenshot" width="510"/></div>
<p>Before we jump into what :before and :after actually do in CSS and how you can use them to accomplish some cool stuff, let&#8217;s clear up one more major point of confusion. If you look around the web for examples of :before and :after in use, you&#8217;ll find two different syntaxes.</p>
<p>Sometimes developers will use a single colon, other times they&#8217;ll use two. Do the two perform different functions? Not at all, it turns out they&#8217;re exactly the same from a functional perspective, meaning both will achieve the same result and are used for the same purpose. So why the difference? Here&#8217;s an example:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*CSS2*/</span>
<span style="color: #6666ff;">.example</span><span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.example</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.example</span><span style="color: #3333ff;">:first-child </span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*CSS3*/</span>
<span style="color: #6666ff;">.example</span><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.example</span><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.example</span><span style="color: #3333ff;">:first-child </span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>As you can see, in CSS2, we used a single colon to represent both pseudo-classes and pseudo-elements. However, to help differentiate between the two, CSS3 includes a second colon <strong>only on pseudo-elements</strong>.</p>
<h3>IE Ruins Everything, Again</h3>
<p>So why do we still see both syntaxes in modern examples and tutorials? Are some developers just ignorant of the change? That might be the case, but the likely answer for most of these inconsistencies lies with our old friend Internet Explorer, destroyer of all things new and good in the world of web development.</p>
<p>It turns out that all <em>modern</em> browsers accept the double colon syntax, but sadly, IE8  does not. For this reason, when coding with ::before and ::after, most developers opt for compatibility over convention and simply use the CSS2 single colon syntax. To keep things simple and consistent, we&#8217;ll stick with this more widely compatible syntax for the rest of this discussion. </p>
<h2>What Are :before and :after?</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-beforeafter-8.jpg" alt="screenshot" width="510"/></div>
<p>That was a lot of groundwork but it&#8217;s all necessary to know when you&#8217;re going into a discussion on using :before and :after in CSS. Now we can finally jump in and see how these things work. </p>
<p>The concept here is actually really simple. Both :before and :after allow you to actually add to your HTML elements from your CSS without cluttering your presentational markup. This opens up a lot of possibilities for adding little decorative elements that don&#8217;t necessarily merit extra markup.</p>
<p>For instance, let&#8217;s say you have a few phone numbers throughout your site and would like to place the ☎ icon in front of them. You can use the :before pseudo element to do just that:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.phoneNumber</span><span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;&amp;#9742;&quot;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>This code will actually insert the little icon before every element marked with the .phoneNumber class. The :after code works exactly the same way only, as you can guess, it will place the icon after the phone number. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.phoneNumber</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;&amp;#9742;&quot;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h2>A Brief Example</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-beforeafter-3.jpg" alt="screenshot" width="510"/></div>
<p>One reason that :before and :after have become so incredibly popular lately is for their ability to dramatically increase the complexity of pure CSS design elements. Without any additional markup, we can use these pseudo elements to add in additional style-able elements and layers. </p>
<p>To see how this works, let&#8217;s style a simple button. These are the basic styles that style the .button class to be round with a red gradient:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*Rounded Corners and Shadows*/</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.4</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.4</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.4</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/*Ridiculous Gradient Syntax*/</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#e51d16</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Old browsers */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#e51d16</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#b21203</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* FF3.6+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#e51d16</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> color-stop<span style="color: #00AA00;">&#40;</span><span style="color: #933;">100%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#b21203</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome,Safari4+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#e51d16</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#b21203</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Chrome10+,Safari5.1+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -o-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#e51d16</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#b21203</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Opera 11.10+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -ms-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#e51d16</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#b21203</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE10+ */</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span>  <span style="color: #cc00cc;">#e51d16</span> <span style="color: #933;">0%</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#b21203</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* W3C */</span>
  filter<span style="color: #00AA00;">:</span> progid<span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span>.gradient<span style="color: #00AA00;">&#40;</span> startColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#e51d16'</span><span style="color: #00AA00;">,</span> endColorstr<span style="color: #00AA00;">=</span><span style="color: #ff0000;">'#b21203'</span><span style="color: #00AA00;">,</span>GradientType<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE6-9 */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Amazingly enough, all of this work will result in a fairly plain looking circle button:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-beforeafter-1.jpg" alt="screenshot" width="510"/></div>
<p>Now, let&#8217;s say we want to add a slightly darker area outside the button and give it an inner shadow so the whole thing looks slightly inset. Rather than adding extra markup, we can simply use an empty pseudo-element.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span><span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now we can style this to add the desired effect. This is the basis for many of the fancy, difficult to wrap your mind around CSS styling tutorials you see on the web today. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span><span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> -<span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ddd</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-15px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-15px</span><span style="color: #00AA00;">;</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #993333;">inset</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.4</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #993333;">inset</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.4</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  box-shadow<span style="color: #00AA00;">:</span> <span style="color: #993333;">inset</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.4</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now our button has a little bit more dimensionality to it. The :before pseudo-element is evident in the outer ring. We gave it a z-index of -1 to drop it behind the button and used absolute positioning to nudge it into place. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-beforeafter-2.jpg" alt="screenshot" width="510"/></div>
<p>Now let&#8217;s say we wanted to do the same thing one more time. This go around we can access the :after pseudo-element and repeat the process.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.button</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> -<span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#eee</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-25px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-25px</span><span style="color: #00AA00;">;</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
  -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #993333;">inset</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.4</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #993333;">inset</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.4</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  box-shadow<span style="color: #00AA00;">:</span> <span style="color: #993333;">inset</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0.4</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>This simply adds in another layer. Now our button appears to have a double inset from the top canvas:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-beforeafter-3.jpg" alt="screenshot" width="510"/></div>
<h3>Demo</h3>
<p>If you want to see this in action and play around with the code, check out the live demo on <a href="http://tinkerbin.com/SulIoOck">Tinkerbin</a>. Can you use the basic structure to make your own fancy button?</p>
<h2>What Else Can You Do With :before and :after?</h2>
<p>By now you should know quite a bit about :before and :after and how they are being used in modern web design. It turns out though that the rabbit hole goes deeper still, these pseudo-elements are being used for all kinds of crazy stuff. Here are a couple of popular uses that you should know about: </p>
<h3>Micro Clearfix</h3>
<div class="tutorialimage"><a href="http://nicolasgallagher.com/micro-clearfix-hack/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-beforeafter-4.jpg" alt="screenshot" width="510"/></a></div>
<p>Who doesn&#8217;t love a good clearfix? CSS floats can be a real pain (they break the fifth commandment and aren&#8217;t nice to their parent elements) and developers everywhere are constantly looking for a better way to clear them.</p>
<p><a href="http://nicolasgallagher.com/micro-clearfix-hack/">Nicolas Gallagher</a> came up with what appears to be the current favorite clearfix hack, which utilizes :before and :after in a creative way.  </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* For modern browsers */</span>
<span style="color: #6666ff;">.cf</span><span style="color: #3333ff;">:before</span><span style="color: #00AA00;">,</span>
<span style="color: #6666ff;">.cf</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span>table<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.cf</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span><span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* For IE 6/7 (trigger hasLayout) */</span>
<span style="color: #6666ff;">.cf</span> <span style="color: #00AA00;">&#123;</span>
    zoom<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Here the :before pseudo-element prevents top-margin collapse and the :after pseudo-element is used to clear the floats. It&#8217;s a pretty nifty solution that uses a lot less code than other notable cross-browser friendly attempts. </p>
<p>Before you run off and leave a comment, I both know about and use the <em>overflow: hidden</em> method. This is simply an alternative that&#8217;s particularly helpful when the overflow trick isn&#8217;t appropriate. </p>
<h3>CSS Shapes</h3>
<div class="tutorialimage"><a href="http://www.css3shapes.com/"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/css-beforeafter-5.jpg" alt="screenshot" width="510"/></a></div>
<p>Another really interesting use of :before and :after is to create complex shapes using pure CSS instead of images. This is accomplished through some really clever manipulation of borders along with some pseudo-element magic.</p>
<p><a href="http://www.css3shapes.com/">CSS3Shapes.com</a> has some awesome examples of basic shapes that you can build using this method. For instance, here&#8217;s the code for an octagon.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#octagon</span> <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span> 
   <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span> 
   <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#octagon</span><span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> 
   <span style="color: #000000; font-weight: bold;">border-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span> <span style="color: #993333;">solid</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">border-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span> 
   <span style="color: #000000; font-weight: bold;">border-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#octagon</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span>
   <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> 
   <span style="color: #000000; font-weight: bold;">border-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span> <span style="color: #993333;">solid</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">;</span> 
   <span style="color: #000000; font-weight: bold;">border-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>  
   <span style="color: #000000; font-weight: bold;">border-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span> 
   <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">70px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>As you can see, :before and :after are called, positioned and then given borders. This combines various simple shapes into complex ones. Pretty spiffy!</p>
<h3>Even More Pseudo-Element Goodness</h3>
<p>If you&#8217;re looking for even more crazy stuff to do with pseudo-elements, Chris Coyier has an <a href="http://css-tricks.com/pseudo-element-roundup/">awesome roundup of possible applications</a> on his site CSS-Tricks. </p>
<h2>Conclusion</h2>
<p>By now you should pretty much be an expert on :before and :after in CSS. You should know the difference between pseudo-classes and pseudo-elements and why the latter is often seen with either a double or single colon. You should also know how :before and :after work on a basic level and have a good idea for how to use them to create some impressively advanced CSS voodoo. </p>
<p>Leave a comment below and let us know if you learned anything. What other great tricks have you seen performed with pseudo-elements? </p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/the-lowdown-on-before-and-after-in-css/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Build a Fun Trivia Game With the CSS Active Selector</title>
		<link>http://designshack.net/articles/css/css-active-tutorial/</link>
		<comments>http://designshack.net/articles/css/css-active-tutorial/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 06:00:03 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[:active]]></category>
		<category><![CDATA[selector]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=28424</guid>
		<description><![CDATA[We&#8217;ve done a ton of fun stuff recently with the :hover selector. From button hover effects for beginners to more advanced hover tutorials and even onto using hovers with multiple backgrounds. Today we&#8217;re moving on and learning about a related but equally awesome selector that often gets overlooked. With :active, we can control the state [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/activetut-0.jpg" alt="screenshot" width="510"/></div>
<p>We&#8217;ve done a ton of fun stuff recently with the <em>:hover</em> selector. From <a href="http://designshack.net/articles/css/four-simple-and-fun-css-button-hover-effects-for-beginners/">button hover effects for beginners</a> to <a href="http://designshack.net/articles/css/5-cool-css-hover-effects-you-can-copy-and-paste">more advanced hover tutorials</a> and even onto <a href="http://designshack.net/?p=26842">using hovers with multiple backgrounds</a>. Today we&#8217;re moving on and learning about a related but equally awesome selector that often gets overlooked.</p>
<p>With <em>:active</em>, we can control the state of an object while it&#8217;s being clicked. Typically, this takes the simple form of changing a link&#8217;s color while the mouse is pressed down, but we&#8217;re going to do something much more interesting. Follow along as we build a super cool, pure CSS presidential trivia game. </p>
<p><span id="more-28424"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>What We&#8217;re Building</h2>
<p>The basic idea here is pretty simple. We have a grid of eight pictures with the goal of identifying the men depicted, each of which is a former U.S. president. Hovering over an image slides it down a bit to reveal further instruction, which encourages you to click. Clicking and holding will slide the image down further to reveal the name of the president shown. </p>
<div class="tutorialimage"><a href="http://designshack.net/tutorialexamples/presidents/index.html"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/activetut-2.jpg" alt="screenshot" width="510"/></a></div>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/presidents/index.html">Click here</a> to launch the live version<br />
<strong>Download:</strong> <a href="http://designshack.net/tutorialexamples/presidents/DesignShack-ActiveTut.zip">Click here</a> to download the source files</p>
<h2>Pseudo-class Selectors</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/activetut-1.jpg" alt="screenshot" width="510"/></div>
<p>A pseudo-class selector is something that we can use in CSS to modify a basic selector. If this sounds too technical for your liking, don&#8217;t worry, you already use these without even knowing it! The one that you&#8217;re likely to be most familiar with is the <em>:hover</em> pseudo-class selector, which allows you to change the appearance of something on hover. You might also be familiar with fancier pseudo-class selectors such as <em>:first-child</em>.</p>
<p>Regarding links or anchors, there are four of these pseudo-class selectors that you should be familiar with. Here they are with explanations for their use: </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #3333ff;">:link </span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span> <span style="color: #808080; font-style: italic;">/*non-clicked links*/</span>
<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span> <span style="color: #808080; font-style: italic;">/*currently in a mouse-over state*/</span>
<span style="color: #3333ff;">:active </span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span> <span style="color: #808080; font-style: italic;">/*currently being clicked*/</span>
<span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span> <span style="color: #808080; font-style: italic;">/*clicked links*/</span></pre></div></div>

</div>
<p></ br></p>
<p>As you can see, our often used hover selector is part of a nice little family that can govern the style of a link at pretty much every state of its existence. It&#8217;s important to note though that this would be a much more interesting set of tools if <em>:visited</em> weren&#8217;t so problematic. Due to security hassles, browsers actually limit what you can do with this pseudo-class. For instance, you can use it change the color of a link, but you can&#8217;t manipulate that link&#8217;s background image. </p>
<p>For this reason, we turn to <em>:active</em> if we want to do anything really fun with a pure CSS click event. It&#8217;s not intuitive to click and hold though so you should tread carefully when using this functionality and always be sure to clearly instruct the user. </p>
<p>Enough of the boring stuff, let&#8217;s get started on our project!</p>
<h2>The HTML</h2>
<p>The HTML for our project is pretty simple. We start off with a brief introduction that states what the game is and how to play it. Here we ask a simple question: &#8220;Who Were the First Eight U.S. Presidents?&#8221; Notice that all of this is thrown into a simple container div. </p>
<p>Next, we create a reusable module to hold our image, which serves as a sort of visual question, and the answer, a simple paragraph that hides below the image. The concept of being reusable is key here. We want to repeat this for seven other presidents and we obviously don&#8217;t want to go through the pain of styling each module individually. For this reason, we apply a class (president), which we can style once and have those styles affect everything that the class is applied to. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Who Were the First Eight U.S. Presidents?<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Click and hold a picture below to see the <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">em</span>&gt;</span>:active<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">em</span>&gt;</span> selector in action.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;president&quot;</span>&gt;</span>
    	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Click for the answer:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> George Washington <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>(1789–1797)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
    	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pres1.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>There are a few things to note about the structure of the president div. First, I&#8217;ve got a little bit of voodoo going on with the paragraph. First of all, I&#8217;ve broken the information up into three sections: instruction, name and presidential term. Each piece is put on its own line via a <a href="http://www.w3schools.com/html5/tag_br.asp">break tag</a>. The initial line uses a <em>small</em> tag, which will serve as an easy way to add a bit of visual differentiation to our text so it&#8217;s not monotonous. </p>
<p>Next up is the image, which is wrapped in an anchor tag. Notice though that I don&#8217;t have a link. This is because our anchor doesn&#8217;t serve as a gateway to another page but simply a clickable object. One important side effect here is that anchors don&#8217;t activate a special hover cursor without an &#8220;href&#8221;, which means we&#8217;ll have to do this manually. </p>
<h3>All Eight Presidents</h3>
<p>Now that we&#8217;ve got our basic HTML structure in place, copy and paste the president div until you have eight of them. Then enter the appropriate information for the other presidents. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;president&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Click for the answer:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> George Washington <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>(1789–1797)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pres1.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;president&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Click for the answer:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> John Adams <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>(1797–1801)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pres2.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;president&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Click for the answer:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> Thomas Jefferson <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>(1801–1809)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pres3.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;president&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Click for the answer:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> James Madison <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>(1809–1817)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pres4.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;president&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Click for the answer:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> James Monroe <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>(1817–1825)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pres5.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;president&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Click for the answer:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> John Quincy Adams <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>(1825–1829)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pres6.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;president&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Click for the answer:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> Andrew Jackson <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>(1829–1837)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pres7.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;president&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Click for the answer:<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> Martin Van Buren <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>(1837–1841)<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pres8.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Progress Check</h3>
<p>At this point, we have pretty much all of the HTML that we&#8217;re going to need. However, since we haven&#8217;t styled anything, your live preview should still look pretty rough. You can see everything starting to take shape though, specifically notice that our <em>small</em> tags are already working perfectly. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/activetut-3.jpg" alt="screenshot" width="510"/></div>
<h2>Starter CSS</h2>
<p>Now it&#8217;s time to add some style to our quiz. We&#8217;ll start by defining the easy stuff: the container dimensions and instructional typography. We&#8217;ll toss on a generic container size of 960px and add in a margin of &#8220;20px auto&#8221; to center the div horizontally and bring it down from the top a little.</p>
<p>We also need to make the h1 and p tags look good so we toss in some basic font styling. I got a little fancy here and used the CSS child selector (.container > p) to target only paragraphs that are direct descendants of the container. This will ignore the paragraph tags nestled into our president divs. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.container</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">960px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">37px</span>/<span style="color: #cc66cc;">1.5</span> Georgia<span style="color: #00AA00;">,</span> Times<span style="color: #00AA00;">,</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.container</span> <span style="color: #00AA00;">&gt;</span> p <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span>/<span style="color: #cc66cc;">1.5</span> Verdana<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Progress Check</h3>
<p>Now you should have some nice margins that move the content away from the edge and a pretty headline that no longer uses the default typographic styling. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/activetut-4.jpg" alt="screenshot" width="510"/></div>
<h2>Style the President Class</h2>
<p>Now we&#8217;re going to start adding some style to the president class, which should make a huge difference in our layout. To start, we want to float them all to the left and set their dimensions. Since we&#8217;ll be sliding the images in and out, we set the overflow to hidden so nothing breaks out of our little 200px by 200px box. </p>
<p>Next we set the margin to 20px, this is not an arbitrary number. It&#8217;s the carefully calculated value that allows four images per row in our layout. Our width is 960px, which is divided up between four 200px wide images, but 4*200 equals 800, leaving 160 pixels left for margins. 160px/4 images is 40px of margin per image, 20 on the left and 20 on the right. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.president</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*IE*/</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> .2<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span><span style="color: #993333;">pointer</span><span style="color: #00AA00;">;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/*CSS3 Fancy Inset Shadow*/</span>
	-webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #993333;">inset</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">20px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> .3<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	-moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #993333;">inset</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">20px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> .3<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	box-shadow<span style="color: #00AA00;">:</span> <span style="color: #993333;">inset</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">20px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span> .3<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
&nbsp;
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>There are some other points of interest here as well. We&#8217;ll be adding some z-index voodoo later, which actually makes any background color cover up our answer text. To account for this, I used an RGBa background fill at 20%. Older versions of IE don&#8217;t like this so they simply get no background fill. </p>
<p>I also set the cursor to &#8220;pointer&#8221; which will make the little hand appear when we hover over a president. Finally, I added an inset shadow just to make our background look a little nicer. This part is completely optional. </p>
<h3>Progress Check</h3>
<p>At this point things are looking a little weird, but we&#8217;re on the right path. Our president images are being contained and clipped, which is good, but the background text is actually pushing them down, which we don&#8217;t want. Instead we want the image to float over the text. We&#8217;ll accomplish this in the next step.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/activetut-5.jpg" alt="screenshot" width="510"/></div>
<h2>Fix the Text Styles and Stacking Order</h2>
<p>Before we proceed to making all of this work, let&#8217;s style our paragraph text real quick. If we wait any longer it will be hidden behind the images and harder to keep an eye on.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.president</span> p <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span> <span style="color: #933;">13px</span>/<span style="color: #cc66cc;">1.5</span> Verdana<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">4px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">190px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.president</span> p small <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span>/<span style="color: #cc66cc;">1.5</span> Verdana<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>These styles should make all our text look much better. Notice that even though the small tag has default styling, it can and should be easily overridden in a manual fashion. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/activetut-6.jpg" alt="screenshot" width="510"/></div>
<h3>Putting the Text Behind the Images</h3>
<p>As I mentioned above, we don&#8217;t want our paragraphs to push down the image but instead hide behind it. To accomplish this we set it free from the flow from with absolute positioning and then move it behind the image with a z-index of -1. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.president</span> p <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> -<span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">4px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">190px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span> <span style="color: #933;">13px</span>/<span style="color: #cc66cc;">1.5</span> Verdana<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.president</span> p small <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span>/<span style="color: #cc66cc;">1.5</span> Verdana<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>This gets everything right where we want it. The text is hiding behind the image and each image is finally being shown in its full form. The problem? There&#8217;s no way to see the answer!</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/activetut-7.jpg" alt="screenshot" width="510"/></div>
<h2>Bring It to Life</h2>
<p>Now that we&#8217;ve got everything right where we want it, it&#8217;s time to add the interaction. Let&#8217;s think about how we want it to work: We&#8217;ve already got the default state coded so we&#8217;re good there. The next step is the hover event. This should bump down the image, but only a little, just enough to show the first line of text. Then on the click, we want to bring the image down even further. </p>
<p>This all needs to happen with some nice transitions of course so it turns out that our first step is to set these up on the images. As always, we need a million different versions to account for all of the various browsers:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a img <span style="color: #00AA00;">&#123;</span>
	-webkit-transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">margin</span> 0.3s ease<span style="color: #00AA00;">;</span>
	-moz-transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">margin</span> 0.3s ease<span style="color: #00AA00;">;</span>
	-o-transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">margin</span> 0.3s ease<span style="color: #00AA00;">;</span>
	-ms-transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">margin</span> 0.3s ease<span style="color: #00AA00;">;</span>
	transition<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">margin</span> 0.3s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>With these transitions in place, any time we change the margins on our images, the transition will be animated. So our next step is to define the hover event with our favorite pseudo-class selector. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a<span style="color: #3333ff;">:hover </span>img <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>This adds a little bit of margin to the top of our image so that when the user hovers over it, this is what they&#8217;ll see:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/activetut-8.jpg" alt="screenshot" width="510"/></div>
<p>This serves as a nice little tip for how to get the answer. If we showed the full answer here, we would likely have an issue with accidental reveals, the click serves as a more concrete way to ensure intentionality. </p>
<p>Our final piece of CSS is what we came here to learn about: the active pseudo class selector. By implementing this small but powerful final piece, our entire trivia game comes together.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a<span style="color: #3333ff;">:active </span>img <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Now when a user clicks on an image and holds the button down, the image of the president slides down and his name is revealed. With that, we&#8217;re all finished!</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/activetut-9.jpg" alt="screenshot" width="510"/></div>
<h2>Conclusion</h2>
<p>After reading through this tutorial you should know a ton of great stuff about some of the most popular pseudo class selectors and how to use them to come up with some really interesting results. We combined the hover and active selectors to create a pure CSS trivia game where the user first hovers and then clicks to see a hidden message. </p>
<p>Leave a comment below and let us know if you learned anything. Also be sure to check out the <a href="http://designshack.net/tutorialexamples/presidents/index.html">live demo</a>. Can you name all eight presidents successfully?</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/css-active-tutorial/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to Build a Responsive Thumbnail Gallery</title>
		<link>http://designshack.net/articles/css/how-to-build-a-responsive-thumbnail-gallery/</link>
		<comments>http://designshack.net/articles/css/how-to-build-a-responsive-thumbnail-gallery/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 15:42:51 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[responsive]]></category>
		<category><![CDATA[thumbnail]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=28157</guid>
		<description><![CDATA[Recently I set out to build a responsive thumbnail gallery. I expected it to take me a few minutes, but in reality it took me a few hours to work through. We&#8217;ll walk through a similar process today to help you get your mind wrapped around how it works. One major component of mastering responsive [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-0.jpg" alt="screenshot" width="510"/></div>
<p>Recently I set out to build a responsive thumbnail gallery. I expected it to take me a few minutes, but in reality it took me a few hours to work through. We&#8217;ll walk through a similar process today to help you get your mind wrapped around how it works. </p>
<p>One major component of mastering responsive design is to figure out how to approach specific tasks and adjust to problems as they arise within the context of larger projects. One day you&#8217;ll be working on a project and will need a responsive gallery and you&#8217;ll remember this post on that very topic. </p>
<p><span id="more-28157"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>Sneak Peek</h2>
<p>Before we get started, take a quick look at what we&#8217;re building. Be sure to resize your browser window page to get a glimpse of just how well the page responds to different viewport sizes.</p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/responsivegallery/index.html">Click here</a> to launch the demo.</p>
<div class="tutorialimage"><a href="http://designshack.net/tutorialexamples/responsivegallery/index.html"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-9.jpg" alt="screenshot" width="510"/></a></div>
<h2>Initial HTML</h2>
<p>Let&#8217;s jump into this project with some basic HTML. Instead of using plain old images in our gallery, we&#8217;ll go for something that&#8217;s much more versatile. For any given entry, you might want an image, title and brief description. Wrap all of this into a repeatable element and throw it all into a container div. It should look something like this:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;galleryItem&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;...&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>Title<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Lorem ipsum dolor sit amet...<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;galleryItem&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;...&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>Title<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Lorem ipsum dolor sit amet...<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>To add items to the gallery, simply copy and paste the <em>galleryItem</em> div (our example will use ten of these). From here we can see what we&#8217;ll need to target in our CSS. We have two classes: <em>container</em> and <em>galleryItem</em>. We also have some images, h3 tags and paragraphs. For the images, I&#8217;ll be using photos from <a href="http://lorempixel.com/">LoremPixel</a>. </p>
<h2>Container Styles</h2>
<p>To begin our CSS, let&#8217;s set a width to the container and center it on the page. This gives us a nice, wide area to work in for our gallery.  </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.container</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">80%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Notice that I&#8217;ve set the width with a percent. This how we make sure the whole page is nice and fluid. We don&#8217;t want the design to merely look good for a few preset breakpoints, instead we to make sure that it can continually adapt to whatever viewport is being used. </p>
<h2>Basic Gallery Styles</h2>
<p>Now let&#8217;s attack the galleryItem class basic styles. We&#8217;ll set the text color and font-size and float the items to the left. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.galleryItem</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#797478</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span>/<span style="color: #cc66cc;">1.5</span> Verdana<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.galleryItem</span> h3 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.galleryItem</span> img <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">max-width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
	-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>I also added some image styling here. By setting the max-width of the images to 100%, I&#8217;ve ensured that, as the page gets narrower, the images will follow suit. I finished off by slightly rounding off the corner of each image. </p>
<p>We&#8217;ll add the column widths in the next step but for now I wanted to give you a preview of what the text and image styles will look like once we get all that worked out. If you&#8217;re following along, you should only have on wide column at this point but your text should look like this:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-3.jpg" alt="screenshot" width="510"/></div>
<h2>Flowing the Columns</h2>
<p>This is the trickiest part. We need to figure out our width and margin for each of the elements in the gallery. As with the container as a whole, each of these will need to use a percentage so they adapt to changes in the viewport size.</p>
<p>As a starting point, I&#8217;d like to use a five column design. To figure out the math necessary to pull this off, it&#8217;s easiest to start with the margins. I want a four percent margin between each column, so multiply that by five columns and we know that twenty percent of our width will be eaten up by margins, which leaves eighty percent for content. Eighty percent divided by five equals a sixteen percent width for each column. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-1.jpg" alt="screenshot" width="510"/></div>
<p>Now we can add these values to the CSS that we&#8217;ve already established. Each .galleryItem class represents one column, so each will have a width of 16% and a margin of 2% on each side for a combined total of 4% per item. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.galleryItem</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#797478</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span>/<span style="color: #cc66cc;">1.5</span> Verdana<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>	
&nbsp;
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16%</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span>  <span style="color: #933;">2%</span> <span style="color: #933;">2%</span> <span style="color: #933;">50px</span> <span style="color: #933;">2%</span><span style="color: #00AA00;">;</span>	
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>This gives us a perfect five column layout that looks great on screens that are 13-inches or larger. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-2.jpg" alt="screenshot" width="510"/></div>
<h3>Where It Gets Ugly</h3>
<p>Unfortunately, this layout really starts to suck as we reduce out page size. By the time we&#8217;re under 500px wide it has completely lost its readability and usefulness. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-4.jpg" alt="screenshot" width="510"/></div>
<p>To address this problem, we&#8217;ll use media queries to insert some breakpoints that will reflow the columns to a more appropriate size. </p>
<h2>Deciding On Breakpoints</h2>
<p>There&#8217;s been a lot of discussion lately on which breakpoints you should aim for in your design. The market is saturated with different devices all at different sizes, and it&#8217;s not easy to account for all of these specifically.</p>
<p>To simplify this task, let&#8217;s scrap our thoughts about what size screen the most popular devices have and let our design itself decide where the breakpoints are. If we analyze the points where our layout breaks down, we can fix those specific areas, thereby making our design look good on every conceivable device (our fluid grid takes care of the in-between).</p>
<h3>Where Does It Break?</h3>
<p>The best way to test this is just to open our live preview in a browser and start reducing the window size. Technically, our layout will never break because it&#8217;s built to scale. However, at around 940px, the columns of text start to become far too narrow for my liking:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-5.jpg" alt="screenshot" width="510"/></div>
<p>To account for this, I need to bring the column count down to four instead of five at that point. By reducing our column width to 21%, we can do this very thing. Since I&#8217;m using both &#8220;max-width&#8221; and &#8220;max-device-width&#8221; here, the design will reflow on both desktop browser windows (at this size and lower) as well as any devices with physical screen sizes under this width. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@media only screen and (max-width : 940px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">940px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #6666ff;">.galleryItem</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">21%</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Adding in these styles fixes this problem up nicely. Our five column design now works perfectly from full size down to 940px, at which point it turns into a four column design.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-6.jpg" alt="screenshot" width="510"/></div>
<h3>Lather, Rinse and Repeat</h3>
<p>At this point, you just repeat this same process over and over. Keep reducing the window size and watching for a point where the design no longer functions well. I quickly find another problematic area around 720px:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-7.jpg" alt="screenshot" width="510"/></div>
<p>This time we want to bring the design down to a two column design, which is done with a column width of around 29.33%.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@media only screen and (max-width : 720px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">720px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #6666ff;">.galleryItem</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">29.33333%</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/responsivegallery-8.jpg" alt="screenshot" width="510"/></div>
<p>I continued this process all the way down the the point where I only had one column right around the size of the iPhone. Here&#8217;s the full set of media queries.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* MEDIA QUERIES*/</span>
<span style="color: #a1a100;">@media only screen and (max-width : 940px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">940px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #6666ff;">.galleryItem</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">21%</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #a1a100;">@media only screen and (max-width : 720px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">720px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #6666ff;">.galleryItem</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">29.33333%</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #a1a100;">@media only screen and (max-width : 530px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">530px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #6666ff;">.galleryItem</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">46%</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #a1a100;">@media only screen and (max-width : 320px),</span>
only screen and <span style="color: #00AA00;">&#40;</span>max-device-<span style="color: #000000; font-weight: bold;">width</span> <span style="color: #00AA00;">:</span> <span style="color: #933;">320px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #6666ff;">.galleryItem</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">96%</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #6666ff;">.galleryItem</span> img <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">96%</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #6666ff;">.galleryItem</span> h3 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">18px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #6666ff;">.galleryItem</span> p<span style="color: #00AA00;">,</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">18px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h2>Conclusion</h2>
<p>There we have it. You should now have a nicely formatted responsive thumbnail gallery that looks great on just about every device and browser window size.</p>
<p>Instead of thinking about which media queries are the most popular, we instead analyzed the points where our specific design ceased being functional and reduced the number of columns at that point to make for a better reading experience. The result is a design that excels in the in-between. </p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/how-to-build-a-responsive-thumbnail-gallery/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Mastering Mouse Enter and Exit Events With CSS Transitions</title>
		<link>http://designshack.net/articles/css/mastering-mouse-enter-and-exit-events-with-css-transitions/</link>
		<comments>http://designshack.net/articles/css/mastering-mouse-enter-and-exit-events-with-css-transitions/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 06:00:43 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[mousein]]></category>
		<category><![CDATA[mouseout]]></category>
		<category><![CDATA[transitions]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=28025</guid>
		<description><![CDATA[While working on a recent post that utilized CSS transitions, I stumbled upon some interesting revelations completely by accident. Switching up where you place the transition syntax can have a dramatic effect on how the transition is carried out. Today we&#8217;re going to go over the various options for CSS transition syntax and how each [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mouseinout-5.jpg" alt="screenshot" width="510"/></div>
<p>While working on a recent post that utilized CSS transitions, I stumbled upon some interesting revelations completely by accident. Switching up where you place the transition syntax can have a dramatic effect on how the transition is carried out. </p>
<p>Today we&#8217;re going to go over the various options for CSS transition syntax and how each affects the animation given whether your mouse is entering or exiting a hover. </p>
<p><span id="more-28025"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>Mouse Events in CSS</h2>
<p>CSS transitions give us the awesome ability to implement simple animations without JavaScript. However, since there&#8217;s really not much talk about it in CSS, you would think that differing your mouse over and mouse out effects would still be something squarely in the realm of JavaScript. After all, there&#8217;s no support for something like this:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">div <span style="color: #00AA00;">&#123;</span>
	mouseover-transition<span style="color: #00AA00;">:</span> all 2s ease<span style="color: #00AA00;">;</span>
	mouseout-transition<span style="color: #00AA00;">:</span> all 1s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>However, it turns out you can in fact effectively control these two different variables. It&#8217;s simply not a very intuitive process. Let&#8217;s take a look at how it works.</p>
<p><em>If you want to skip the discussion and go straight to the syntax, <a href="http://css-tricks.com/different-transitions-for-hover-on-hover-off/">CSS Tricks</a> has a good example of this technique.</em></p>
<h2>The Normal Syntax: Mouse In and Out Are Equal</h2>
<div class="tutorialimage"><a href="http://dabblet.com/gist/1535314"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mouseinout-1.jpg" alt="screenshot" width="510"/></a></div>
<p>There are a few different ways that we can go about applying a CSS transition. The first one we&#8217;ll look at is the plain old default, meaning we&#8217;ll use the standard syntax that you&#8217;ll find if you run a Google search for how to implement a CSS transition.</p>
<p>For experimentation purposes, we&#8217;ll keep the demo simple. We want the transition to animate the shift from a black square to a gray circle. Here&#8217;s how this looks (browser prefixes omitted for cleanliness):</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#loremdiv</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	transition<span style="color: #00AA00;">:</span> all 1s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#loremdiv</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">gray</span><span style="color: #00AA00;">;</span>
	transform<span style="color: #00AA00;">:</span> rotate<span style="color: #00AA00;">&#40;</span>1080deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>The behavior of this animation is typical. When you hover over the black square, in the course of one second it spins around as it increases its border radius to 100px and changes its color, making it a gray circle. Then when you take your mouse out, the opposite happens. The square spins counter clockwise back to its original position has its border radius steadily decreases and its color goes back to black. </p>
<p><strong>Demo:</strong> <a href="http://dabblet.com/gist/1535314">Click here</a> to see this example in action.</p>
<h2>Reversed Syntax: No Mouse Out Transition</h2>
<div class="tutorialimage"><a href="http://dabblet.com/gist/1535412"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mouseinout-2.jpg" alt="screenshot" width="510"/></a></div>
<p>In the previous example, we placed the transition syntax in the <em>#loremdiv</em> selector. What happens if we reverse this and place the same snippet inside of the <em>#loremdiv: hover</em> selector? </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#loremdiv</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#loremdiv</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">gray</span><span style="color: #00AA00;">;</span>
	transform<span style="color: #00AA00;">:</span> rotate<span style="color: #00AA00;">&#40;</span>1080deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	transition<span style="color: #00AA00;">:</span> all 1s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Even though it feels wrong, it turns out that this still produces a transition. However, it <strong>only</strong> produces a transition on the hover event, when the user exits the hover, the transformation is immediate.</p>
<p>This effectively gives us what we were looking for: a way to vary the mouse in and mouse out transitions. However, the mouse out is really no transition at all at this point, which isn&#8217;t very exciting.  </p>
<p><strong>Demo:</strong> <a href="http://dabblet.com/gist/1535412">Click here</a> to see this example in action.</p>
<h2>Doubled Syntax: Two Customizable Transitions</h2>
<div class="tutorialimage"><a href="http://dabblet.com/gist/1535470"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mouseinout-3.jpg" alt="screenshot" width="510"/></a></div>
<p>Now we&#8217;ve tried linking the transition to the normal selector and we&#8217;ve tried putting it in the hover selector, now let&#8217;s see what happens when we put a transition in <strong>both</strong> places. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#loremdiv</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	transition<span style="color: #00AA00;">:</span> all 0.3s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#loremdiv</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">gray</span><span style="color: #00AA00;">;</span>
	transform<span style="color: #00AA00;">:</span> rotate<span style="color: #00AA00;">&#40;</span>1080deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	transition<span style="color: #00AA00;">:</span> all 1s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Notice that I&#8217;ve reduced the amount of time on the first transition so that we can tell what it does. Interestingly enough, the result here is the opposite of what many people expect. </p>
<p>Intuitively, you might come to the conclusion that the first transition statement will be applied on mouse in and the second on mouse out. However, the opposite is true. As we discovered in our last example, the snippet associated with the hover selector affects the mouse in event, leaving the other one for the mouse out. </p>
<p>Now we have the setup that we were shooting for! This gives us complete freedom to vary the mouse in and mouse out effects. What I&#8217;ve done with this example is reduce the amount of time that it takes for the animation to complete when the user exits the hover. </p>
<p><strong>Demo:</strong> <a href="http://dabblet.com/gist/1535470">Click here</a> to see this example in action.</p>
<h2>Varying the Effects</h2>
<div class="tutorialimage"><a href="http://dabblet.com/gist/1535530"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mouseinout-4.jpg" alt="screenshot" width="510"/></a></div>
<p>Taking this idea even further, you can&#8217;t only vary the time, you can also vary the property and timing function. Here&#8217;s an example:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#loremdiv</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	transition<span style="color: #00AA00;">:</span> border-radius 0.5s ease-in<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#loremdiv</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">gray</span><span style="color: #00AA00;">;</span>
	transform<span style="color: #00AA00;">:</span> rotate<span style="color: #00AA00;">&#40;</span>1080deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
	border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	transition<span style="color: #00AA00;">:</span> all 1s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>Here I stuck with the same animation that we&#8217;ve been using for the hover event, but when the user exits the hover, the only thing that animates back is the border radius. </p>
<p><strong>Demo:</strong> <a href="http://dabblet.com/gist/1535530">Click here</a> to see this example in action.</p>
<h2>Conclusion</h2>
<p>To sum up, there are three basic ways that you can approach CSS transitions. The first way is to link the transition to a non-hover selector. This makes the hover in and out transitions the same (only in reverse of course). The second way is to link the transition to a hover selector. This creates a hover in transition but eliminates the hover out transition.</p>
<p>Finally, the third way is to link transitions to both selectors. In this case, the non-hover transition will affect the <strong>hover out</strong> event and the hover transition will effect the <strong>hover in</strong> event. This is the technique that you&#8217;ll want to go with if you want the most control over 	the separate events.</p>
<p>Leave a comment below and let us know what you think of all this. Have you ever noticed that separate hover in/out events were possible? Have you utilized this in any way? </p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/mastering-mouse-enter-and-exit-events-with-css-transitions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Journey Into Mordor With CSS</title>
		<link>http://designshack.net/articles/css/journey-into-mordor-with-css/</link>
		<comments>http://designshack.net/articles/css/journey-into-mordor-with-css/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 06:00:00 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=27921</guid>
		<description><![CDATA[Today&#8217;s project is silly and fun, but it does have a real point and educational purpose. In a recent article, I explored five ways to use multiple CSS background images to create cool hover effects. I had one idea in that article that I didn&#8217;t get to simply because its complexity merited a standalone explanation. [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mordor-0.jpg" alt="screenshot" width="510"/></div>
<p>Today&#8217;s project is silly and fun, but it does have a real point and educational purpose. In a <a href="http://designshack.net/?p=26842">recent article</a>, I explored five ways to use multiple CSS background images to create cool hover effects. I had one idea in that article that I didn&#8217;t get to simply because its complexity merited a standalone explanation. </p>
<p>This article then is an extension of that previous discussion. We&#8217;ll be using multiple backgrounds to create a cool cinematic effect where someone traverses a map while the vantage point zooms out. The best and most nerd-tastic way to show this off is of course to use the familiar tale of Frodo crossing Middle Earth to arrive at Mount Doom in Mordor. Let&#8217;s get started. </p>
<p><span id="more-27921"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>The Concept</h2>
<p>The basic idea for this hover effect is simple. There&#8217;s a container with two different backgrounds. The one on the bottom of the stack fills the entire container, the one on the top of the stack is much smaller. On hover, the full bleed image (which actually extends well beyond the container) moves left while the small image moves right. This is a super fundamental animation technique that makes it look like the subject is moving through the scene. </p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mordor-2.jpg" alt="screenshot" width="510"/></div>
<p>To make things even more interesting, I want the scene to start on a zoomed in view of the subject and then pan out to view the landscape as a whole. </p>
<h3>Why Middle Earth?</h3>
<p>The most practical use that I could think of for this idea was to show someone moving across a map. This is a pretty typical use case. Whether your company just changed locations or your family just went on vacation, you&#8217;ll find it pretty easy to come up with a decent excuse to implement a fun map animation.</p>
<div class="pullquote-r">
&#8220;Feel free to make fun of me in the comments, after seeing the demo, my wife ensures me that I deserve it.&#8221;
</div>
<p></ br></p>
<p>Now, given that I&#8217;m a huge nerd who is completely excited about the upcoming film, &#8220;The Hobbit,&#8221; my mind immediately jumped to a scene from Middle Earth. Consequently, today&#8217;s project evolved into a hat tip to the last cinematic hobbit journey. Feel free to make fun of me in the comments, after seeing the demo, my wife ensures me that I deserve it. </p>
<h3>Why Multiple Background Images?</h3>
<p>Could we do this same thing with images dropped into our HTML? Yep. Would it give us even more freedom to manipulate the images? You bet. </p>
<p>Then why don&#8217;t we use HTML? Because the entire point of the exercise is to learn how to wield multiple background images in CSS, that&#8217;s why! One day you&#8217;ll be forced to code something with multiple background images and you&#8217;ll fortunately know all about them. </p>
<h2>See It In Action</h2>
<p>Before we start building, let&#8217;s get a look at what we&#8217;re trying to create. Click below to check out the finished product. </p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/mordor/index.html">Click here</a> to launch the live version.</p>
<div class="tutorialimage"><a href="http://designshack.net/tutorialexamples/mordor/index.html"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mordor-7.jpg" alt="screenshot" width="510"/></a></div>
<h2>Getting Started: The HTML</h2>
<p>This experiment uses all CSS with minimal markup. All you really need for the entire project is a single empty div. That&#8217;s it!</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;middleEarth&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>Obviously, you can add text and other objects to make the item more complex but for today&#8217;s purposes, this is all the HTML we need. </p>
<h2>Size Up the Div</h2>
<p>Before proceeding with anything else, we need to decide on a size for our div. This will influence all the rest of our decisions. I chose a good sized rectangle: 500px wide by 375px tall. I then centered it on the page and dropped it down from the top of the page by 20px. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#middleEarth</span> <span style="color: #00AA00;">&#123;</span>  
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">500px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">375px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h2>Prepare your Images</h2>
<p>To follow along, you&#8217;ll need two images: a map and a subject. You can use anything you like but I chose the two images below for reasons already explained:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mordor-3.jpg" alt="screenshot" width="510"/></div>
<p>My <a href="http://blog.lefigaro.fr/hightech/assets_c/2011/06/middle-earth-map-33096.html">Middle Earth map</a> is fairly large: 1000px by 750px and my Frodo image is fairly small: 100px by 100px. </p>
<h2>Plan the Animation</h2>
<p>Now that we have our images, we need to think carefully about what it is that we&#8217;re trying to do. Obviously, Frodo starts his journey in The Shire, so we&#8217;ll need to zoom in on the Northwest quadrant of the map and position the small image somewhere in that area.</p>
<p>He then makes a journey to Mordor, which is in the Southeast quadrant, so we want Frodo to move down and to the right in a diagonal line. At the beginning of the animation, we want to be zoomed in on The Shire but at the end of the animation we want to see the whole of Middle Earth. Here are the two states for our map size:</p>
<ul>
<li>Beginning Map Size: 1,000 by 750 pixels (full size)</li>
<li>End Map Size: 500 by 375 pixels (the div size)</li>
</ul>
<p>Frodo will also need to change size since we are zooming out. Since the numbers above worked out to perfectly cutting the image size in half, we&#8217;ll follow suit here: </p>
<ul>
<li>Beginning Frodo Size: 100 by 100 pixels (full size)</li>
<li>End Frodo Size: 50 by 50 pixels (half size)</li>
</ul>
<p>We&#8217;ll also need to position the images, but that&#8217;s easier to do on the fly as we insert them so let&#8217;s proceed to that step.</p>
<h2>Insert the Images</h2>
<p>Now it&#8217;s time to toss the images into our div. The great thing about using multiple backgrounds is that you don&#8217;t need any crazy vendor prefixes, you don&#8217;t even really need to learn new syntax, just drop one image in like always, insert a comma, then toss in another image. </p>
<p>Here I&#8217;ve thrown in some line returns for clarity. They add in extra space, but help keep the code readable. Keep in mind that the stacking order in the code will represent the stacking order in the live version. Here the map is on the bottom and the subject is on top, which is exactly what we need (this is all in the #middleEarth selector).</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span>
	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'frodo.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">,</span>
	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'middleearth.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span></pre></div></div>

</div>
<p></ br></p>
<p>Here&#8217;s what this gives us:</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mordor-4.jpg" alt="screenshot" width="510"/></div>
<p>The good news is that the map is, by default, positioned with the top left as its origin, which is exactly what we want. The bad news is that Frodo is positioned the same way so we&#8217;ll need to move him over to The Shire to start.</p>
<p>To position the Frodo image, simply add in a horizontal and vertical position after the &#8220;no-repeat&#8221; bit. The best way to do this is just to experiment and see what works. I came up with 150px 150px, which puts him right next to the label for The Shire. </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span>
	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'frodo.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #933;">150px</span> <span style="color: #933;">150px</span><span style="color: #00AA00;">,</span>
	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'middleearth.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span></pre></div></div>

</div>
<p></ br></p>
<p>Our initial setup is now right where we want it to be.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mordor-5.jpg" alt="screenshot" width="510"/></div>
<h2>Applying Separate Image Sizes</h2>
<p>To make sure the animation works poperly, we need to make sure we get a few key things right. One important step is to declare our background image sizes.</p>
<p>These aren&#8217;t necessary at first as we&#8217;re simply using the default size, but we can&#8217;t animate the change without explicitly stating the starting and stopping parameters. We simply use the <em>background-size</em> property with and throw in a comma to separate the values. Just as with inserting the images, we can uniquely manipulate the corresponding properties of each image using a comma.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span>
	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'frodo.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #933;">150px</span> <span style="color: #933;">150px</span><span style="color: #00AA00;">,</span>
	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'middleearth.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
background-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">,</span> <span style="color: #933;">1000px</span> <span style="color: #933;">750px</span><span style="color: #00AA00;">;</span></pre></div></div>

</div>
<p></ br></p>
<h2>Hover Styles</h2>
<p>On hover, Frodo needs to set off to Mordor as the map begins to zoom out. We&#8217;ve already figured out most of what we need to do this. This time our background sizes need to be 50px by 50px and 500px by 375px (shrinks Frodo, zooms out to show full map). Also, we need to move Frodo way down to Middle Earth so we crank up the horizontal and vertical shift to 400px and and 240px respectively.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#middleEarth</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span>
    <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'frodo.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #933;">400px</span> <span style="color: #933;">240px</span><span style="color: #00AA00;">,</span>
    <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'middleearth.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
  background-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">,</span> <span style="color: #933;">500px</span> <span style="color: #933;">375px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>This puts good old Frodo right in the heart of Mordor.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/mordor-6.jpg" alt="screenshot" width="510"/></div>
<h2>Final Step: The Animation</h2>
<p>Now we have our starting point and our stopping point all set up, all that&#8217;s left is the animation. Of course, we&#8217;ll use CSS transitions for this. CSS keyframe animations would be much more fun and would allow us to do lots more (like make appropriate stops along the way), but they&#8217;re not as widely supported so we&#8217;ll have to stick to transitions. </p>
<p>On hover, I want the journey to be nice and long, about five seconds. When you stop hovering, the animation should reverse back to where it started. However, I want it to be much quicker here, about one second.</p>
<p>To accomplish this, we need to set up two separate transitions. The first one goes in the <em>#middleEarth</em> selector and is set to one second. Oddly enough, this will control the mouse-out animation. The second transition goes inside the <em>#middleEarth:hover</em> selector, this controls the mouse-in animation. </p>
<p>Here&#8217;s our completed CSS, which shows everything you need to make it all work:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#middleEarth</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">500px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">375px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/*Background*/</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'frodo.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #933;">150px</span> <span style="color: #933;">150px</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'middleearth.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
	background-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">,</span> <span style="color: #933;">1000px</span> <span style="color: #933;">750px</span><span style="color: #00AA00;">;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/*Mouse Out Animation*/</span>
	-webkit-transition<span style="color: #00AA00;">:</span> all 1s ease<span style="color: #00AA00;">;</span>
	-moz-transition<span style="color: #00AA00;">:</span> all 1s ease<span style="color: #00AA00;">;</span>
	-o-transition<span style="color: #00AA00;">:</span> all 1s ease<span style="color: #00AA00;">;</span>
	-ms-transition<span style="color: #00AA00;">:</span> all 1s ease<span style="color: #00AA00;">;</span>
	transition<span style="color: #00AA00;">:</span> all 1s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#middleEarth</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'frodo.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #933;">400px</span> <span style="color: #933;">240px</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'middleearth.jpg'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
	background-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">,</span> <span style="color: #933;">500px</span> <span style="color: #933;">375px</span><span style="color: #00AA00;">;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/*Mouse In Animation*/</span>
	-webkit-transition<span style="color: #00AA00;">:</span> all 5s ease<span style="color: #00AA00;">;</span>
	-moz-transition<span style="color: #00AA00;">:</span> all 5s ease<span style="color: #00AA00;">;</span>
	-o-transition<span style="color: #00AA00;">:</span> all 5s ease<span style="color: #00AA00;">;</span>
	-ms-transition<span style="color: #00AA00;">:</span> all 5s ease<span style="color: #00AA00;">;</span>
	transition<span style="color: #00AA00;">:</span> all 5s ease<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<h2>Conclusion</h2>
<p>With that, we&#8217;re all finished! You should now know a ton of great stuff about using multiple backgrounds: how to apply them in the proper staking order, position them independently and animate each image&#8217;s size and position. </p>
<p>Be sure to take another look at <a href="http://designshack.net/tutorialexamples/mordor/index.html">the demo</a> to see the project in action and let us know what you think in the comment section below. </p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/journey-into-mordor-with-css/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>5 Incredibly Useful Tools Built Into Twitter Bootstrap</title>
		<link>http://designshack.net/articles/css/5-incredibly-useful-tools-built-into-twitter-bootstrap/</link>
		<comments>http://designshack.net/articles/css/5-incredibly-useful-tools-built-into-twitter-bootstrap/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 06:00:30 +0000</pubDate>
		<dc:creator>Joshua Johnson</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[bootstrap]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://designshack.net/?p=27707</guid>
		<description><![CDATA[Bootstrap is an interesting framework or &#8220;toolkit&#8221; offered up to developers completely free of charge by none other than Twitter.com. According to Twitter, Bootstrap is &#8220;designed to kickstart development of webapps and sites.&#8221; Today we&#8217;re going to jump into Bootstrap and take a quick look at some of the things that it has to offer. [...]]]></description>
			<content:encoded><![CDATA[<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/twitterbootstrap-1.jpg" alt="screenshot" width="510"/></div>
<p><a href="http://twitter.github.com/bootstrap/">Bootstrap</a> is an interesting framework or &#8220;toolkit&#8221; offered up to developers completely free of charge by none other than Twitter.com. According to Twitter, Bootstrap is &#8220;designed to kickstart development of webapps and sites.&#8221;</p>
<p>Today we&#8217;re going to jump into Bootstrap and take a quick look at some of the things that it has to offer. This should help you decide whether this is just another bloated framework or an incredibly useful tool that you should use to kickstart your next project. </p>
<p><span id="more-27707"></span><br />
<em>Like the article? Be sure to subscribe to our <a href="feed://feeds.feedburner.com/designshack">RSS feed</a> and follow us on <a href="http://twitter.com/designshack">Twitter</a> to stay up on recent content.</em></p>
<h2>What Can You Do With Bootstrap?</h2>
<p>Bootstrap is sort of a Swiss Army Knife for developers. It&#8217;s simply loaded with tools and utilities, some of which you&#8217;ll find extremely useful, others you&#8217;ll never touch. </p>
<p>The real goal behind Bootstrap is to save you time. Twitter has done the heavy lifting for you by researching and implementing some of the best ways to perform various tasks. They&#8217;ve also taken several steps towards applying solid basic styles to various commonly used elements.</p>
<p>Should you take this as it is and turn your critical brain off during development? Absolutely not! You should dig in, find what you like and ditch or change what you don&#8217;t. Bootstrap is specifically built to handle customization in many cases so feel free to go nuts and make it your own. </p>
<h3>Getting Started</h3>
<p>If you want to implement some of the styles we&#8217;ll be working with on the fly, you can simply hotlink to the Bootstrap CSS file like so:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css&quot;</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>We&#8217;ll be going a step further and digging into some of the optional LESS files so it might also be helpful to just stop by GitHub and <a href="https://github.com/twitter/bootstrap">download the entire project</a>.</p>
<p>Once you have all of that ready to go, it&#8217;s time to move on and see what this thing has to offer. I won&#8217;t be going through a step by step tutorial of every single feature in Bootstrap, it&#8217;s pretty huge and the <a href="http://twitter.github.com/bootstrap/">documentation</a> should have you covered. This will merely serve as a quick overview for some of the things that I find useful about Bootstrap and how you can quickly and easily take advantage of them in your own code. </p>
<h3>Demo</h3>
<div class="tutorialimage"><a href="http://designshack.net/tutorialexamples/bootstrap/index.html"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/twitterbootstrap-9.jpg" alt="screenshot" width="510"/></a></div>
<p>Click the link below to see Twitter Bootstrap in action. I built this sample page in only a few minutes utilizing the techniques that we&#8217;ll go over below.</p>
<p><strong>Demo:</strong> <a href="http://designshack.net/tutorialexamples/bootstrap/index.html">Click here</a> to launch the demo.</p>
<h2>#1: A Prebuilt Grid</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/twitterbootstrap-3.jpg" alt="screenshot" width="510"/></div>
<p>The first thing that we should discuss is the grid. Every good framework has one and Bootstrap is no exception. You don&#8217;t have to use the grid to benefit from the wealth of styles offered up by Bootstrap but it is the key element to using this toolkit to perform rapid page layout with almost no effort.</p>
<p>By default, the grid is 940px wide with 16 columns. Each column is 40px with a gutter of 20px. Like 960.gs, Blueprint and others, this grid is a little div heavy and requires some markup that you may not love, but in the end it&#8217;s actually really easy to use and makes using Bootstrap a snap.</p>
<p>The grid works primarily on row and span classes. Rows are self-explanatory, when you want to start a new row, create a div and apply the &#8220;row&#8221; class. Everything for that row goes in that div, when it&#8217;s time for another row, close the old one and start a new one.</p>
<p>For each div within a row, you apply the &#8220;span#&#8221; class with &#8220;#&#8221; being the number of columns you want the div to span.</p>
<h3>Grid Example</h3>
<p>Let&#8217;s say we were mocking up a layout that used a large header image that covered the full width of the site above four columns of text. The markup for this is simple:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;row&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;span16&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;row&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;span4&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;span4&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;span4&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;span4&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>The styling for this will be completely automated. All you have to do is drop some content into the HTML above and you&#8217;ve got yourself a layout.</p>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/twitterbootstrap-4.jpg" alt="screenshot" width="510"/></div>
<p>Just like 960.gs, the Bootstrap grid also supports nesting and columns. You can even make the page fluid by throwing everything into a div with a <em>&#8220;container-fluid&#8221;</em> class, or simply use <em>&#8220;container&#8221;</em> for fixed width.</p>
<h2>#2: LESS</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/twitterbootstrap-5.jpg" alt="screenshot" width="510"/></div>
<p>LESS, the increasingly famous CSS preprocessor, gets a big endorsement here from Twitter with a ton of built in support. They&#8217;ve really gone all out and created a lot of LESS mixins and variables for you to work with right out of the box. </p>
<p>Let&#8217;s take a quick look at just a few of the things that you can do with Bootstrap and LESS.</p>
<h3>Customize the Grid</h3>
<p>The Bootstrap grid is built using LESS mixins and CSS math so it&#8217;s easy to customize. Just change a couple of variables and everything is automatically updated. For instance, let&#8217;s say you wanted a twelve column grid instead of a sixteen column one, simply go into &#8220;variables.less&#8221;, find the grid variables and change the number of columns to twelve. It&#8217;s that easy.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">// Modify the grid variables
<span style="color: #a1a100;">@gridColumns:       12;</span>
<span style="color: #a1a100;">@gridColumnWidth:   40px;</span>
<span style="color: #a1a100;">@gridGutterWidth:   20px;</span></pre></div></div>

</div>
<p></ br></p>
<h3>CSS3 Without the Hassle</h3>
<p>Bootstrap makes it easy to use a few of your favorite CSS3 tricks without the pain of manually repeating yourself for every browser. You&#8217;ll find helpful mixins for implementing rounded corners, shadows and transitions.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">// Border Radius
.border-radius<span style="color: #00AA00;">&#40;</span><span style="color: #a1a100;">@radius: 5px) {</span>
  -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@radius;</span>
     -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@radius;</span>
          border-radius<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@radius;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
// Drop shadows
.box-shadow<span style="color: #00AA00;">&#40;</span><span style="color: #a1a100;">@shadow: 0 1px 3px rgba(0,0,0,.25)) {</span>
  -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@shadow;</span>
     -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@shadow;</span>
          box-shadow<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@shadow;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
// Transitions
.transition<span style="color: #00AA00;">&#40;</span><span style="color: #a1a100;">@transition) {</span>
     -webkit-transition<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@transition;</span>
        -moz-transition<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@transition;</span>
         -ms-transition<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@transition;</span>
          -o-transition<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@transition;</span>
             transition<span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@transition;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>There are also resources for creating gradients and color schemes using the magic of LESS. </p>
<h3>Clearfix</h3>
<p>If you stick to the prebuilt grid, you shouldn&#8217;t have to manually set up and clear floats, but if you go your own way with layout the built-in clearfix mixin can save you a lot of hassle.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">// Clearfix for clearing floats like a boss h5bp.com/q
.clearfix<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">&#123;</span>
  zoom<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
  &amp;<span style="color: #3333ff;">:before</span><span style="color: #00AA00;">,</span>
  &amp;<span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> table<span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span>
    zoom<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span>
  &amp;<span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
<p></ br></p>
<p>To implement this, all you have to do is type <em>&#8220;.clearfix()&#8221;</em> in your .less file. The structure here mirrors the method used by <a href="http://nicolasgallagher.com/micro-clearfix-hack/">Nicolas Gallagher</a>.</p>
<h2>#3: Navigation</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/twitterbootstrap-6.jpg" alt="screenshot" width="510"/></div>
<p>One of Bootstrap&#8217;s most convenient pieces is the awesome navigation toolkit provided, which you can use to implement several different types of complex navigation elements in seconds.</p>
<h3>Main Navigation</h3>
<p>For instance, there&#8217;s an awesome main navigation bar that looks sharp, allows for easy custom branding and even stays with you as your scroll (shown above on top). The markup seems unnecessarily heavy but it sure does make it easy to create a really slick menu (support for dropdowns included as well). </p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;topbar&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;topbar-inner&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;brand&quot;</span>&gt;</span>Design Shack<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
		 	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nav&quot;</span>&gt;</span>
			 	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Home<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			 	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>About<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			 	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Gallery<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			 	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Articles<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			 	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Deals<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
			 	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Submit<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		 	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
 		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br> </p>
<h3>Tabs</h3>
<p>You can also easily implement a tabbed navigation scheme. This markup looks much nicer and really couldn&#8217;t be any easier. Simply add the <em>&#8220;tabs&#8221;</em> class to an unordered list and you&#8217;re done!</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;tabs&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;active&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>The City<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Nature<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Space<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;</span>Other Stuff<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<h3>Even More</h3>
<p>Bootstrap doesn&#8217;t stop there. In it you&#8217;ll find similar constructs for creating breadcrumb navigation, pagination and more. Most of these are implemented just like tabs, with a simple class. </p>
<p>Remember that all of the default styling can be changed so even if you don&#8217;t necessarily like the style used, these tools are extremely helpful for getting the basic structure of your navigations up and running in no time. </p>
<h2>#4: Galleries</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/twitterbootstrap-7.jpg" alt="screenshot" width="510"/></div>
<p>With Bootstrap, image galleries are fairly automated. As with tabs, they simply require an unordered list with a special class, in this case <em>&#8220;media-grid&#8221;</em>. With this applied, the gallery automatically performs the layout work taking into account the size of your images. That being said, Twitter recommends using sizes such as 90, 210, and 330, which work well with the layout.</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;row&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;span16&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;media-grid&quot;</span>&gt;</span>
	    		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	    		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	    		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	    		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;img.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	    	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<p>Gallery images come pre-styled with borders, rounded corners, padding, hover styles; everything you need to get a grid of images in place and functioning. You can even mix image sizes and the grid will automatically handle the differences without breaking your page layout.</p>
<h2>#5: JavaScript Goodness</h2>
<div class="tutorialimage"><img class="alignNone size-full wp-image-1611" src="http://designshack.co.uk/wp-content/uploads/twitterbootstrap-8.jpg" alt="screenshot" width="510"/></div>
<p>Thus far we&#8217;ve primarily discussed the HTML and CSS goodies packed into Bootstrap, but this toolkit goes well beyond style and structure and adds plenty of functionality benefits as well. You&#8217;ll find <a href="http://twitter.github.com/bootstrap/javascript.html#">JavaScript libraries</a> for implementing tooltips, modal windows alerts and more.</p>
<p>You&#8217;ll also need some JavaScript to bring some of the elements we&#8217;ve already seen to life. For instance, there are built in functions for making each tab load separate content and for handling the dropdown menu items. </p>
<p>By utilizing data attributes, you can even skip writing the JavaScript. Here&#8217;s a sample snippet that lets you implement a tool-tip right from your HTML:</p>
<div style="overflow: auto; background-color: #eeeeee;">

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> data-placement<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;below&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'twipsy'</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'Some title text'</span>&gt;</span>text<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></div></div>

</div>
<p></ br></p>
<h2>Conclusion</h2>
<p>This article is meant to give you a very brief peek into some of the great tools that are available to you in Twitter Bootstrap. Whether you&#8217;re looking for a quick way to perform a complex layout or simply want some nice UI elements like tabs and buttons, Bootstrap has you covered. </p>
<p>There are things here and there that I might not agree with, but on the whole I think Twitter has succeeded in creating a genuinely useful set of tools. I&#8217;m always thrilled to see corporations offering up valuable resources to the web design community free of charge. Do you know of any similar tools from other companies? Let us know in the comments below.</p>
]]></content:encoded>
			<wfw:commentRss>http://designshack.net/articles/css/5-incredibly-useful-tools-built-into-twitter-bootstrap/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Object Caching 868/962 objects using disk: basic

Served from: designshack.net @ 2012-02-10 04:08:14 -->
