<?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>CSS Wizardry &#187; CSS3</title>
	<atom:link href="http://csswizardry.com/tag/css3/feed/" rel="self" type="application/rss+xml" />
	<link>http://csswizardry.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 16 May 2012 12:57:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fully fluid, responsive CSS carousel</title>
		<link>http://csswizardry.com/2011/10/fully-fluid-responsive-css-carousel/</link>
		<comments>http://csswizardry.com/2011/10/fully-fluid-responsive-css-carousel/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 22:46:10 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>
		<category><![CDATA[Responsive web design]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=3288</guid>
		<description><![CDATA[If you follow me on Twitter you&#8217;ll know I&#8217;ve been pretty enthused about this fluid CSS carousel of mine. There are two aspects to it; the fluidity and the CSS functionality.
Demo

The demo features photos of me, taken on various mountains by Suze. Cheers to her for the content.
The fluidity
Making a carousel fluid is actually ridiculously [...]]]></description>
			<content:encoded><![CDATA[<p>If you <a href="http://twitter.com/csswizardry">follow me on Twitter</a> you&#8217;ll know I&#8217;ve been pretty enthused about this <a href="http://dl.dropbox.com/u/2629908/sandbox/fluid-css-carousel/index.html">fluid CSS carousel</a> of mine. There are two aspects to it; the fluidity and the CSS functionality.</p>
<h2><a href="http://dl.dropbox.com/u/2629908/sandbox/fluid-css-carousel/index.html">Demo</a></h2>
<p><span id="more-3288"></span></p>
<p>The demo features photos of me, taken on various mountains by <a href="http://twitter.com/suzehaworth">Suze</a>. Cheers to her for the content.</p>
<h2>The fluidity</h2>
<p>Making a carousel fluid is actually ridiculously simple. Let us assume you have five panels. Remember that number!</p>
<p>A carousel is made up of three basic components:</p>
<ol>
<li>A viewport</li>
<li>A wrapper for the panes</li>
<li>A pane</li>
</ol>
<p>Thus, our markup is:</p>
<pre><code>&lt;div class=carousel&gt;

  &lt;ul class=panes&gt;

    &lt;li&gt;
      &lt;h2&gt;Pane 01 title&lt;/h2&gt;
      &lt;img src=pane-01.jpg alt=""&gt;
    &lt;/li&gt;

    &lt;li&gt;
      &lt;h2&gt;Pane 02 title&lt;/h2&gt;
      &lt;img src=pane-02.jpg alt=""&gt;
    &lt;/li&gt;

    &lt;li&gt;
      &lt;h2&gt;Pane 03 title&lt;/h2&gt;
      &lt;img src=pane-03.jpg alt=""&gt;
    &lt;/li&gt;

    &lt;li&gt;
      &lt;h2&gt;Pane 04 title&lt;/h2&gt;
      &lt;img src=pane-04.jpg alt=""&gt;
    &lt;/li&gt;

    &lt;li&gt;
      &lt;h2&gt;Pane 05 title&lt;/h2&gt;
      &lt;img src=pane-05.jpg alt=""&gt;
    &lt;/li&gt;

  &lt;/ul&gt;

&lt;/div&gt;</code></pre>
<p>Now, the viewport defines what we see, we slide our panes behind it and they poke through, like this:</p>
<p><img src="http://csswizardry.com/wp-content/uploads/2011/10/carousel-anatomy.jpg" alt="Anatomy of a carousel"></p>
<p>The red denotes the viewport (and incidentally a single pane), the blue denotes the whole five panes <em>behind</em> the viewport.</p>
<p>We just slide these behind the viewport to show a certain amount at a time, et voilà; carousel. But, you all know how carousels work, right&#8230;?</p>
<p>To make this fluid is so simple. The viewport needs to fill its container, so this gets <code>width:100%;</code>. Easy.</p>
<p>One pane needs to fit nicely in the viewport, so this needs to occupy 100% of the viewport. With this in mind&#8230;</p>
<p>We have five panes, remember, so the <code>ul</code> needs a width of 500%. Five panes that are each the same width as the viewport gives us a width of <strong>500%</strong>.</p>
<p>Now we know:</p>
<pre><code>.carousel{
  width:100%;
}
.panes{
  width:500%;
}</code></pre>
<p>So if <code>.panes</code> holds five panes, each pane should be 20% its width. This is where it might get a little confusing&#8230;</p>
<p>The viewport is 100% width, the wrapper is five times as big as that and each pane is one fifth the width of the wrapper.</p>
<p>Our code is left at:</p>
<pre><code><span class=code-comment>/*------------------------------------*\
	$CAROUSEL
\*------------------------------------*/</span>
.carousel{
    overflow:hidden;
    <mark>width:100%;</mark>
}
.panes{
    list-style:none;
    position:relative;
    <mark>width:500%;</mark> <span class=code-comment>/* Number of panes * 100% */</span>
    overflow:hidden; <span class=code-comment>/* This is used solely to clear floats, it does not add functionality. */</span>

    -moz-animation:carousel 30s infinite;
    -webkit-animation:carousel 30s infinite;
    animation:carousel 30s infinite;
}
.panes > li{
    position:relative;
    float:left;
    <mark>width:20%;</mark> <span class=code-comment>/* 100 / number of panes */</span>
}
.carousel img{
    display:block;
    width:100%;
    max-width:100%;
}
.carousel h2{
    font-size:1em;
    padding:0.5em;
    position:absolute;
    right:10px;
    bottom:10px;
    left:10px;
    text-align:right;
    color:#fff;
    background-color:rgba(0,0,0,0.75);
}</code></pre>
<p>The basic equation for making a carousel with any number of panes is:</p>
<pre><code>.carousel{
  width:100%;
}
.panes{
  width:<mark>100 * number of panes</mark>%;
}
.panes > li{
  width:<mark>100 / number of panes</mark>%;
}</code></pre>
<p>So, a four-pane carousel would be:</p>
<pre><code>.carousel{
  width:100%;
}
.panes{
  width:<mark>400</mark>%;
}
.panes > li{
  width:<mark>25</mark>%;
}</code></pre>
<p>It really is that simple. That&#8217;s all there is to making a fluid carousel.</p>
<h2>CSS powered</h2>
<p>Okay, in this carousel I decided I was going to power it with CSS. This is super unorthodox so if you&#8217;re yelling <q>WTF</q> at your screen please read on!</p>
<p>It was going to be (and actually is) used on my good friend <a href="http://sampenrose.co.uk/">Sam Penrose&#8217;s new design portfolio</a>, so knowing we had free reign and a little chance to experiment I decided to opt for a pure CSS solution.</p>
<p>This is simple in theory but the maths gets <em>so</em> tricky.</p>
<p>All we do is animate <code>.panels</code> from right to left then back again. We animate for a bit, we pause, we animate again, pause again and so on until it&#8217;s done. Then we loop it infinitely.</p>
<p>The CSS is:</p>
<pre><code>@keyframes carousel{
    0%    { left:0; }
    11%   { left:0; }
    12.5% { left:-100%; }
    23.5% { left:-100%; }
    25%   { left:-200%; }
    36%   { left:-200%; }
    37.5% { left:-300%; }
    48.5% { left:-300%; }
    50%   { left:-400%; }
    61%   { left:-400%; }
    62.5% { left:-300%; }
    73.5% { left:-300%; }
    75%   { left:-200%; }
    86%   { left:-200%; }
    87.5% { left:-100%; }
    98.5% { left:-100%; }
    100%  { left:0; }
}</code></pre>
<p>The numbers are so tricky to work with and if anyone can come up with a decent equation to describe it I would be so happy. I&#8217;ve got <a href="http://twitter.com/makeusabrew">Nick</a> on the job, but I&#8217;ve not worked it out yet; I can&#8217;t quite grasp the relation between five panes and the numbers above in a way that I could do some quick maths to work out the animations for a four-pane carousel.</p>
<p>The problem is that you have to know how many full moves and pauses are needed for a full iteration of the carousel (before it starts on its infinite loop), and then how to evenly space these numbers between 0 and 100%. My animations last for 1.5% and pause for 11%, these numbers are perfect for adding up to 100%.</p>
<h2><ins datetime="2011-11-01T09:27:11+00:00">Update</ins></h2>
<p>Massive thanks to Clay who&#8217;s worked out that the number of steps is 4<var>n</var>-3 and that the total time between start of one animation and the next is 100 / 2(<var>n</var>-1) (where <var>n</var> is the number of panes). See <a href="http://csswizardry.com/2011/10/fully-fluid-responsive-css-carousel/#comment-95396">his full comment</a>.</p>
<p>But, the code above will sort you out a perfect animation for a five panes so feel free to nab it! I&#8217;ll update if and when I crack some maths!</p>
<h3>Wait, CSS?!</h3>
<p>Using CSS for this is really, really unorthodox so comes with some massive caveats.</p>
<p>Do not use CSS to animate this carousel if:</p>
<ol>
<li>You require the contents of every pane to be visually accessible to the user.</li>
<li>You require full browser support.</li>
<li>You do not require interactions (like stopping the animation or clicking between panes).</li>
</ol>
<p>If you are going to use this CSS-only method then ensure that:</p>
<ol>
<li>The user can still use the site fully without the contents of the panes.</li>
<li>You are okay with older browsers not animating and just displaying the first pane.</li>
<li>You do not want or require users to be able to interact with the carousel.</li>
</ol>
<p>If you can&#8217;t use CSS then combine the fluidity above with plain ol&#8217; trusty JS.</p>
<p>I will happily say that the fluidity is the most important, useful and impressive thing about this technique. Until I, or anyone, can get you a decent equation to substitute your numbers into, the CSS animations are too cumbersome and restrictive to be of large-scale use to most people.</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2011/10/fully-fluid-responsive-css-carousel/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Font sizing with rem could be avoided</title>
		<link>http://csswizardry.com/2011/05/font-sizing-with-rem-could-be-avoided/</link>
		<comments>http://csswizardry.com/2011/05/font-sizing-with-rem-could-be-avoided/#comments</comments>
		<pubDate>Tue, 31 May 2011 20:13:32 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=2770</guid>
		<description><![CDATA[Jonathan Snook wrote recently about the new font-sizing unit rem. Whilst I do find it interesting and potentially useful I do think it possibly solves a problem that doesn&#8217;t actually exist&#8230;
N.B. This article isn&#8217;t a response to Jonathan&#8217;s, nor am I calling him out, he just happened to have laid some nice foundations with his [...]]]></description>
			<content:encoded><![CDATA[<p>Jonathan Snook <a href="http://snook.ca/archives/html_and_css/font-size-with-rem">wrote recently</a> about the new font-sizing unit <code>rem</code>. Whilst I do find it interesting and potentially useful I do think it possibly solves a problem that doesn&#8217;t actually exist&#8230;</p>
<p><strong>N.B.</strong> This article isn&#8217;t a response to Jonathan&#8217;s, nor am I calling him out, he just happened to have laid some nice foundations with his article that allow me to use it as a base. <ins datetime="2011-06-01T11:57:23+00:00">It is worth noting further that Jonathan a) uses px to declare font-sizes anyway and b) does start with the base he intends to use. This article <em>isn&#8217;t</em> a response to his.</ins></p>
<p>Jonathan uses the example:</p>
<pre><code>body { font-size:62.5%; }
h1 { font-size: 2.4em; } /* =24px */
p  { font-size: 1.4em; } /* =14px */
li { font-size: 1.4em; } /* =14px? */
li li, li p /* etc */ { font-size: 1em; }</code></pre>
<p>Here he sets his base font-size to 10px then creates a <code>h1</code> size of 24px, <code>&lt;p&gt;</code>s and <code>&lt;li&gt;</code>s of 14px and then children of <code>&lt;p&gt;</code>s and <code>&lt;li&gt;</code>s at 1em, also 14px.</p>
<p>Here is a problem that developers continuously cause themselves. It&#8217;s clear here that, although he sets a body font-size of 10px, the actual base font-size is 14px. Therein lies the problem.</p>
<p>Creating a base font-size that you don&#8217;t actually need means you have to redefine nigh on every element to take on the size you <em>do</em> want&mdash;you&#8217;re creating a rule that you don&#8217;t even want and it&#8217;s causing you work&#8230;</p>
<p>If you want your base font-size to be 14px then set your <code>&lt;html&gt;</code> at <code>0.875em</code> and you&#8217;re done. If you want a 24px <code>&lt;h1&gt;</code> then your CSS is simply <code>h1{ font-size:1.714em; }</code>.</p>
<h2>The problem with 62.5%</h2>
<p>The 62.5% trick is a common one, and does have its uses in two circumstances:</p>
<ol>
<li>You want simpler maths, for example if you are building an elastic layout (<code>width:30em;</code> == <code>width:300px;</code>)</li>
<li>You <em>actually</em> want a base font-size of 10px</li>
</ol>
<p>If you are doing neither of these then be kind to yourself and set the base you <em>actually</em> want.</p>
<p>The main reason people reset the font-size to 10px is point one; to make maths easier. If your quasi-base is 10px and you want an actual base of 12px it&#8217;s simply 1.2em. The maths <em>is</em> easier, we can work with units of ten more easily, but that comes at the cost of maintainability.</p>
<p>If you set your quasi-base at 10px and you want your body copy to be 12px, you have to style every single element that falls under &#8216;body copy&#8217; individually. Hence Jonathan&#8217;s giving font-sizes to list items and paragraphs. This means you&#8217;re writing more code than you need and also leads to nasty inheritance problems; problems that rems are supposed to fix. A <code>&lt;p&gt;</code> in an <code>&lt;li&gt;</code> will be 1.2&#215;12px, whereas it still only needs to be 12px.</p>
<p>If you were to just set your base <em>at</em> 12px in the first place (<code>body{ font-size:0.75em; }</code>) then:</p>
<ol>
<li>You don&#8217;t need to define every element individually; you style the exceptions rather than rewriting the rule.</li>
<li>You don&#8217;t get crazy-annoying inheritance issues.</li>
</ol>
<h2>Being lazy is causing you more work</h2>
<p>The main reason, I feel, behind using the 62.5% method is laziness, and that&#8217;s a good thing. Good developers are lazy. However that laziness is misguided; it&#8217;s actually causing you more work. You have to define font-sizes on all elements rather than just once and letting them inherit <em>and</em> you have to tackle those horrible inheritance issues when an explicitly sized element is placed inside another one.</p>
<p>When setting the base font-size correctly and only once the maths isn&#8217;t as nice, I&#8217;ll admit. With the 62.5% trick a font is an even ten times its em unit (2.4em = 24px, 5em = 50px and so on). With setting your base to what you actually want the chances are you <em>will</em> end up with a not-as-nice number. If you want your base to be 16px then 2.4em = 38.4px, 5em = 80px. It&#8217;s a little more work in your calculator app, but it&#8217;s a lot less work when it actually comes down to build.</p>
<p>CSS Wizardry has a base of 16px, so I just leave it at <code>font-size:100%;</code>. 16px is the rule, headings are the exception. As such I only need to redefine font-sizes on headings.</p>
<p>My maths is a little harder, my coding is a breeze&#8230;</p>
<p>So by all means start using <code>rem</code>s, they seem pretty interesting, but it may just be solving a problem you don&#8217;t even have&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2011/05/font-sizing-with-rem-could-be-avoided/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Mobile business card</title>
		<link>http://csswizardry.com/2011/02/mobile-business-card/</link>
		<comments>http://csswizardry.com/2011/02/mobile-business-card/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 23:07:29 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=2559</guid>
		<description><![CDATA[Business card style sites are nothing new. Tim Van Damme popularised them a while ago and they&#8217;re a handy tool for relaying the most basic and important information about yourself in a very short space of time. I made my own business card type site recently (and tweeted about its self-indulgence) and put some nifty [...]]]></description>
			<content:encoded><![CDATA[<p>Business card style sites are nothing new. <a href="http://timvandamme.com/">Tim Van Damme</a> popularised them a while ago and they&#8217;re a handy tool for relaying the most basic and important information about yourself in a very short space of time. I made <a href="/profile/">my own business card type site</a> recently (and <a href="http://twitter.com/#!/csswizardry/status/36048647212761088">tweeted about its self-indulgence</a>) and put some nifty CSS to work&mdash;a digital business card whose content changes when you rotate your mobile.</p>
<p class="hilite"><a href="/profile/">Here it is</a>. Visit this on a desktop browser and in a smartphone (and then try rotating the device).</p>
<p><span id="more-2559"></span></p>
<p>I was inspired after I saw <a href="http://www.engageinteractive.co.uk/">Engage Interactive&#8217;s</a> iPhone site in <a href="http://twitter.com/nicepaul">Paul Annett</a>&#8217;s <cite>.net magazine</cite> article whilst on the train. I only had my iPhone with me which meant that, although in the ideal viewing medium, I wasn&#8217;t able to pick apart any source. As my mind so frequently does, I started coding up a &#8216;my version&#8217; in my head.</p>
<p>After building mine I went and found that Engage&#8217;s iPhone site uses JavaScript and works solely on an iPhone (I imagine some for of browser sniffing is used to detect it). This gives them increased functionality as they have horizontal-left and horizontal-right; I only have horizontal but I wanted a device independent site that would work using <em>only</em> CSS.</p>
<p>Read on for the how-to&#8230;</p>
<hr />
<h2>The code</h2>
<p>What we have here is a page with personal and contact information. We have three possible states: desktop, mobile-portrait and mobile-landscape.</p>
<p>The stacked paper effect is achieved by replicating the appearance of the page <code>&lt;div&gt;</code> in both a <code>:before</code> and <code>:after</code> pseudo-element, giving these a negative <code>z-index</code> and then rotating them. This effect is achieved with no extra markup or images.</p>
<pre><code><span class="code-comment">&lt;!-- Markup --&gt;</span>
&lt;div id=&quot;page&quot;&gt;

  &lt;div id=&quot;about&quot;&gt;

    [content]

  &lt;/div&gt;

  &lt;div id=&quot;contact&quot;&gt;

    [content]

  &lt;/div&gt;

&lt;/div&gt;

<span class="code-comment">/* CSS */</span>
#page{
  position:relative;
  margin:0 auto;
  padding:20px 20px 0 20px;
  border:10px solid #f0f0f0;
  background:#fff;
  width:400px;

  -moz-box-shadow:0 0 10px rgba(0,0,0,0.25);
  -webkit-box-shadow:0 0 10px rgba(0,0,0,0.25);
  -o-box-shadow:0 0 10px rgba(0,0,0,0.25);
  box-shadow:0 0 10px rgba(0,0,0,0.25);
}
#page:before,
#page:after{
  content:&quot; &quot;;
  display:block;
  border:10px solid #f0f0f0;
  background:#fff;
  z-index:-1;
  position:absolute;
  top:-10px;
  right:-10px;
  bottom:-10px;
  left:-10px;

  -moz-box-shadow:0 0 10px rgba(0,0,0,0.25);
  -webkit-box-shadow:0 0 10px rgba(0,0,0,0.25);
  -o-box-shadow:0 0 10px rgba(0,0,0,0.25);
  box-shadow:0 0 10px rgba(0,0,0,0.25);
  -moz-transform:rotate(1deg);
  -webkit-transform:rotate(1deg);
  -o-transform:rotate(1deg);
  transform:rotate(1deg);
}
#page:after{
  z-index:-2;
  -moz-transform:rotate(-1.5deg);
  -webkit-transform:rotate(-1.5deg);
  -o-transform:rotate(-1.5deg);
  transform:rotate(-1.5deg);
}</code></pre>
<p>Each type of content is wrapped in its own <code>&lt;div&gt;</code>. This may, at first, seem extraneous but these are the hooks used to toggle the content displayed on mobile devices in different orientations. If your browser is portrait then hide the contact <code>&lt;div&gt;</code>, if it is landscape them hide the about <code>&lt;div&gt;</code>.</p>
<p>I hide each <code>&lt;div&gt;</code> by absolutely positioning it way off to the left of the screen. This offers more accessibility than a simple <code>display:none;</code>:</p>
<pre><code>@media (max-width: 480px) and (orientation: portrait){

#contact{
  position:absolute;
  left:-9999px;
}

}
@media (max-width: 480px) and (orientation: landscape){

#about{
  position:absolute;
  left:-9999px;
}

}</code></pre>
<p>Further, when the page loads on a mobile device an overlay animates in and out with some Webkit animations, telling the user to <q>‘Try rotating your phone&#8230;’</q></p>
<pre><code><span class="code-comment">&lt;!-- Markup --&gt;</span>
&lt;div id=&quot;mask&quot;&gt;&lt;/div&gt;

&lt;p id=&quot;instructions&quot;&gt;Try rotating your phone&hellip;&lt;/p&gt;

<span class="code-comment">/* CSS */</span>
<span class="code-comment">/*------------------------------------*\
  INSTRUCTIONS
\*------------------------------------*/</span>
#mask,
#instructions{
  display:block;
  -webkit-animation-duration:3s;
  -webkit-animation-iteration-count:1;
  -webkit-animation-timing-function:linear;
}
#mask{
  position:absolute;
  left:-9999px;
  background:rgba(0,0,0,0.75);
  z-index:2;
  -webkit-animation-name:mask;
}
@-webkit-keyframes mask{
0%{
  opacity:0;
}
10%{
  opacity:1;
  top:0;
  right:0;
  bottom:0;
}
90%{
  opacity:1;
  top:0;
  right:0;
  bottom:0;
}
99%{
  opacity:0;
  top:0;
  right:0;
  bottom:0;
}
100%{
  opacity:0;
}
}
#instructions{
  font-family:Calibri, sans-serif; <span class="code-comment">/* Using a non-Typekit face to try and alleviate the delay in text-display */</span>
  width:200px;
  position:absolute;
  top:-9999px;
  left:50%;
  background:rgba(0,0,0,0.75);
  z-index:3;
  padding:10px;
  background:#fef8c4;
  border:1px solid #d8d566;
  margin:-12px 0 0 -100px;
  font-weight:bold;
  text-align:center;

  -moz-box-shadow:0 0 10px rgba(0,0,0,0.75),0 1px #fff inset;
  -webkit-box-shadow:0 0 10px rgba(0,0,0,0.75),0 1px #fff inset;
  -o-box-shadow:0 0 10px rgba(0,0,0,0.75),0 1px #fff inset;
  box-shadow:0 0 10px rgba(0,0,0,0.75),0 1px #fff inset;
  -webkit-animation-name:message;
}
@-webkit-keyframes message{
0%{
  opacity:0;
}
10%{
  opacity:1;
  top:50%;
  left:50%;
}
90%{
  opacity:1;
  top:50%;
  left:50%;
}
99%{
  opacity:0;
  top:50%;
  left:50%;
}
100%{
  opacity:0;
}
}

}
</code></pre>
<p>Another thing to note; the image in the page is used as an inline image, the favicon <em>and</em> the iPhone homescreen icon. The same image has been reused three times, this isn’t anything amazing but it means only one request over a mobile connection.</p>
<h2>Issues</h2>
<p><a href="http://twitter.com/suzehaworth">Suze</a> bought me <a href="http://typekit.com/">Typekit</a> recently which I thought I&#8217;d try out, however there is a little bug on mobile whereby Typekit prevents any text from displaying for a moment. The length of this &#8216;moment&#8217; depends on the speed of your connection.</p>
<p>Furthermore, the overlay mentioned previously is displayed with CSS based on resolution. Ideally you&#8217;d use a more robust method of writing this to the view than saying &#8216;if the screen is really this small then use CSS to display the markup that is there anyway regardless of the device&#8217;. Resolution dependence isn&#8217;t explicit enough because a) no matter what device you are on, the &#8216;rotate you phone&#8217; text is always present in the markup and b) a 27&#8243; iMac will display the text to the user is they resize their browser down far enough; a user can actually see the phone related text on a desktop if they resize enough.</p>
<p>However, this was just a proof-of-concept idea just to see if I <em>could</em> do it&mdash;I&#8217;m pretty pleased with the results.</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2011/02/mobile-business-card/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Creating a pure CSS dropdown menu</title>
		<link>http://csswizardry.com/2011/02/creating-a-pure-css-dropdown-menu/</link>
		<comments>http://csswizardry.com/2011/02/creating-a-pure-css-dropdown-menu/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 09:47:44 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=2547</guid>
		<description><![CDATA[In redeveloping the Venturelab site we became increasingly aware that there was a lot of content that needed navigating extremely simply and fairly rapidly. We have so much to say and such a lot of content that the navigation of the site needed to be even more dynamic and encompassing than normal.
Demo
This article has been [...]]]></description>
			<content:encoded><![CDATA[<p>In redeveloping the Venturelab site we became increasingly aware that there was a lot of content that needed navigating extremely simply and fairly rapidly. We have so much to say and such a lot of content that the navigation of the site needed to be even more dynamic and encompassing than normal.</p>
<h2><a href="http://csswizardry.com/demos/css-dropdown/">Demo</a></h2>
<p class="info-message">This article has been ported from the now-defunct Venturelab Devblog, where I had originally authored it.</p>
<p><span id="more-2547"></span></p>
<p>Each page features a sub-navigation area, which links to all the other pages within that section of the website. This is great, and works perfectly, but in order to get to, say, <a href="http://www.venturelab.co.uk/faq">the FAQs</a> page from the home page, you&#8217;d first have to go to <a href="http://www.venturelab.co.uk/">the about page</a>, then on to the FAQs from there. This is by no means unacceptable, but we like to go that extra step at Venturelab&#8230;</p>
<p><span id="more-75"></span></p>
<p>I was looking at the main menu of the site when inspiration struck. Something as common and simple as a series of dropdown menus under each meta menu item would improve the navigability and usability of the site massively. Also, they are incredibly simple to create, and here&#8217;s where I teach you how&#8230;</p>
<h2>The concept</h2>
<p>What a dropdown menu provides is a hierarchical overview of the subsections contained within the menu item that spawned it. Basically, it lists all the subsections within a section of a site when you hover your mouse cursor over it.</p>
<p>They are extremely useful in showing what a section of a site contains, and allowing you to access it from anyway else in that site, whether that be the parent page of that subsection, or a page in a different section altogether.</p>
<h2>The markup</h2>
<p>A lot of dropdown menus rely on bulky, extraneous markup  and Javascript to work, ours will use only the cleanest HTML and some lean CSS, with some lovely progressive CSS3 for good measure.</p>
<pre><code>&lt;ul id="nav"&gt;
	&lt;li&gt;
		&lt;a href="#"&gt;Home&lt;/a&gt;
	&lt;/li&gt;

	&lt;li&gt;
		&lt;a href="#"&gt;About&lt;/a&gt;
		&lt;ul&gt;
			&lt;li&gt;&lt;a href="#"&gt;The product&lt;/a&gt;&lt;/li&gt;

			&lt;li&gt;&lt;a href="#"&gt;Meet the team&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="#"&gt;Services&lt;/a&gt;

		&lt;ul&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sevice one&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sevice two&lt;/a&gt;&lt;/li&gt;

			&lt;li&gt;&lt;a href="#"&gt;Sevice three&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sevice four&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;

	&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="#"&gt;Product&lt;/a&gt;
		&lt;ul&gt;
			&lt;li&gt;&lt;a href="#"&gt;Small product (one)&lt;/a&gt;&lt;/li&gt;

			&lt;li&gt;&lt;a href="#"&gt;Small product (two)&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Small product (three)&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Small product (four)&lt;/a&gt;&lt;/li&gt;

			&lt;li&gt;&lt;a href="#"&gt;Big product (five)&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Big product (six)&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Big product (seven)&lt;/a&gt;&lt;/li&gt;

			&lt;li&gt;&lt;a href="#"&gt;Big product (eight)&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Enourmous product (nine)&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Enourmous product (ten)&lt;/a&gt;&lt;/li&gt;

			&lt;li&gt;&lt;a href="#"&gt;Enourmous product (eleven)&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="#"&gt;Contact&lt;/a&gt;

		&lt;ul&gt;
			&lt;li&gt;&lt;a href="#"&gt;Out-of-hours&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Directions&lt;/a&gt;&lt;/li&gt;

		&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;</code></pre>
<p>As you can see here the markup is simply a series of nested <code>&lt;ul&gt;</code>s. No verbose IDs/classes, no <code>&lt;div&gt;</code>s, just rich, semantic code.</p>
<p>The <code>#nav</code> <code>&lt;ul&gt;</code> contains a series of <code>&lt;li&gt;</code>s, and any that require a dropdown then contain another <code>&lt;ul&gt;</code>. Notice the dropdown <code>&lt;ul&gt;</code>s have no classes on them&mdash;this is because we use the cascade to style these, keeping our markup even cleaner.</p>
<h2>The CSS</h2>
<p>This is where the magic happens&mdash;we use CSS to transform a series of nested <code>&lt;ul&gt;</code>s into a smooth, easy to use, neat and self-contained dropdown menu.</p>
<pre><code><span class="code-comment">/* BE SURE TO INCLUDE THE CSS RESET FOUND IN THE DEMO PAGE'S CSS */</span>
<span class="code-comment">/*------------------------------------*\
	NAV
\*------------------------------------*/</span>
#nav{
	list-style:none;
	font-weight:bold;
	margin-bottom:10px;
	<span class="code-comment">/* Clear floats */</span>
	float:left;
	width:100%;
	<span class="code-comment">/* Bring the nav above everything else--uncomment if needed.
	position:relative;
	z-index:5;
	*/</span>
}
#nav li{
	float:left;
	margin-right:10px;
	position:relative;
}
#nav a{
	display:block;
	padding:5px;
	color:#fff;
	background:#333;
	text-decoration:none;
}
#nav a:hover{
	color:#fff;
	background:#6b0c36;
	text-decoration:underline;
}

<span class="code-comment">/*--- DROPDOWN ---*/</span>
#nav ul{
	background:#fff; <span class="code-comment">/* Adding a background makes the dropdown work properly in IE7+. Make this as close to your page's background as possible (i.e. white page == white background). */</span>
	background:rgba(255,255,255,0); <span class="code-comment">/* But! Let's make the background fully transparent where we can, we don't actually want to see it if we can help it... */</span>
	list-style:none;
	position:absolute;
	left:-9999px; <span class="code-comment">/* Hide off-screen when not needed (this is more accessible than display:none;) */</span>
}
#nav ul li{
	padding-top:1px; <span class="code-comment">/* Introducing a padding between the li and the a give the illusion spaced items */</span>
	float:none;
}
#nav ul a{
	white-space:nowrap; <span class="code-comment">/* Stop text wrapping and creating multi-line dropdown items */</span>
}
#nav li:hover ul{ <span class="code-comment">/* Display the dropdown on hover */</span>
	left:0; <span class="code-comment">/* Bring back on-screen when needed */</span>
}
#nav li:hover a{ <span class="code-comment">/* These create persistent hover states, meaning the top-most link stays 'hovered' even when your cursor has moved down the list. */</span>
	background:#6b0c36;
	text-decoration:underline;
}
#nav li:hover ul a{ <span class="code-comment">/* The persistent hover state does however create a global style for links even before they're hovered. Here we undo these effects. */</span>
	text-decoration:none;
}
#nav li:hover ul li a:hover{ <span class="code-comment">/* Here we define the most explicit hover states--what happens when you hover each individual link. */</span>
	background:#333;
}</code></pre>
<p class="marginalia">Just a regular horizontal navigation menu&#8230;</p>
<p>Right, let&#8217;s now break that down&#8230; The first section is fairly self explanatory&mdash;here we are just setting up a regular horizontal navigation menu, the same as any other. However, notice that selectors such as <code>#nav li</code> and <code>#nav li a</code> will select all list items and links in the dropdowns too. Here we&#8217;re using the cascade sensibly.</p>
<p>One thing of note however is applying <code>position:relative;</code> to the list items, this allows us to use <code>position:absolute;</code> on the nested <code>&lt;ul&gt;</code>s later on.</p>
<h3>The nested lists</h3>
<pre><code>#nav ul{
	background:#fff; <span class="code-comment">/* Adding a background makes the dropdown work properly in IE7+. Make this as close to your page's background as possible (i.e. white page == white background). */</span>
	background:rgba(255,255,255,0); <span class="code-comment">/* But! Let's make the background fully transparent where we can, we don't actually want to see it if we can help it... */</span>
	list-style:none;
	position:absolute;
	left:-9999px; <span class="code-comment">/* Hide off-screen when not needed (this is more accessible than display:none;) */</span>
}</code></pre>
<p>Here we have the CSS that controls the <code>&lt;ul&gt;</code>s nested within the top level list items. Obviously we need to remove bullets with <code>list-style:none;</code>, then <code>position:absolute;</code> to position the dropdown above the list item that holds it.</p>
<p class="marginalia">A better, more accessible solution than <code>display:none;</code>&#8230;</p>
<p>The next line however is a point of interest. Usually, most people would use <code>display:none;</code> to hide the dropdown while it&#8217;s not being used, but due to a lot of screenreaders ignoring anything with <code>display:none;</code> applied, this is very inaccessible. What we do instead is take advantage of the fact the <code>&lt;ul&gt;</code> is absolutely positioned and just position it <code>-9999px</code> off screen when not in use.</p>
<p>Next up we declare <code>opacity:0;</code> for the hidden <code>&lt;ul&gt;</code> and then a Webkit only declaration which will smoothly fade the <code>&lt;ul&gt;</code> in from fully transparent when hovered.</p>
<pre><code>#nav ul li{
	padding-top:1px; <span class="code-comment">/* Introducing a padding between the li and the a give the illusion spaced items */</span>
	float:none;
}
#nav ul a{
	white-space:nowrap; <span class="code-comment">/* Stop text wrapping and creating multi-line dropdown items */</span>
}
#nav li:hover ul{ <span class="code-comment">/* Display the dropdown on hover */</span>
	left:0; <span class="code-comment">/* Bring back on-screen when needed */</span>
}</code></pre>
<p class="marginalia"><a href="http://www.venturelab.co.uk/devblog/wp-content/uploads/2010/06/gap.jpg"><img src="http://www.venturelab.co.uk/devblog/wp-content/uploads/2010/06/gap.jpg" alt="" /></a> <em>Above: The 1px gap achieved by the <code>padding-top:1px;</code> applied to the list-item</em></p>
<p>Here we set up the default list item and link styles. Notice the padding-top:1px; on the <code>&lt;li&gt;</code>. As all the colours etc are applied to the <code>&lt;a&gt;</code>, putting a 1px padding on the <code>&lt;li&gt;</code> in effect pushes the <code>&lt;a&gt;</code>&mdash;and therefore the colour&mdash;away from the edge of the list item, giving it the illusion that they are all separated. Interestingly, IE will not recognise the layout of the <code>&lt;li&gt;</code> when hovered, closing the dropdown again. To get round this, I added a <a href="http://www.venturelab.co.uk/img/css/dot.gif">1&#215;1px transparent <code>gif</code></a> image as a background. Also here we remove the floats applied earlier.</p>
<p>Next, on <code>#nav ul a</code>, we apply <code>white-space:nowrap;</code> to prevent items wrapping onto two lines, ensuring a consistent display.</p>
<p class="marginalia">And this is where the magic happens&#8230;</p>
<p>The final bit of code is the bit that actually makes the dropdown appear when the list item that contains it is hovered. Now, as the <code>:hover</code> pseudo-class only works on the <code>&lt;a&gt;</code> element in IE6, the dropdowns won&#8217;t work in <em>that</em> browser. That can be alleviated by using a variety of fixes. However, as dropdowns are progressive, then we&#8217;re okay with them not working. If you do however want to get this working in IE6 then my favoured solutions is by <a href="http://www.xs4all.nl/~peterned/csshover.html">using <i>behaviours</i></a>.</p>
<pre><code>#nav li:hover a{ <span class="code-comment">/* These create persistent hover states, meaning the top-most link stays 'hovered' even when your cursor has moved down the list. */</span>
	background:#6b0c36;
	text-decoration:underline;
}</code></pre>
<p class="marginalia">This gets tricky, but it <em>should</em> make sense.</p>
<p>This block of code here is where the hover styles come in, there&#8217;s a bit of nifty code in there which controls what we&#8217;ll call &#8216;persisting hover states&#8217; on the top level item even when the user is hovering the dropdown items&#8230;</p>
<p><code>#nav li:hover a</code> is what allows you to give the top level link a persisting hover state when hovering its &#8216;children&#8217;. This works by styling every link inside a list-item when that list-item is hovered. This bit gets a bit tricky but bear with me:</p>
<ul>
<li>The dropdown <code>&lt;ul&gt;</code> sits inside an <code>&lt;li&gt;</code>.</li>
<li>If you are hovering over a link (<code>&lt;a&gt;</code>) in a dropdown (<code>&lt;ul&gt;</code>) then you are also, at the same time, still hovering the top level list-item (<code>&lt;li&gt;</code>) as you are hovering content inside it.</li>
<li>Because you are technically still hovering the top level list-item, the <code>#nav li:hover a</code> remains true, leaving a persisting hover style on the top level list-item&#8217;s <code>&lt;a&gt;</code> so&#8230;</li>
<li>&#8230;by hovering a dropdown item you are still hovering the top level list-item which means the cascade still styles all links <em>in</em> that list-item. Phew!</li>
</ul>
<pre><code>#nav li:hover ul a{ <span class="code-comment">/* The persistent hover state does however create a global style for links even before they're hovered. Here we undo these effects. */</span>
	text-decoration:none;
}</code></pre>
<p>Here we override certain aspects of the persisting hover state so that the dropdowns differ from the top level link. In this case we merely decide not to underline them.</p>
<p>We also add a touch of Webkit goodness, telling the links to transform. <code>-webkit-transition:-webkit-transform 0.075s linear;</code> tells Webkit to animate the <code>-webkit-transform</code> we apply later on in the code over 0.075 seconds with no fade-in/out. Look out for the initiation of this in the next (and final) block of CSS.</p>
<pre><code>#nav li:hover ul li a:hover{ <span class="code-comment">/* Here we define the most explicit hover states--what happens when you hover each individual link. */</span>
	background:#333;
}</code></pre>
<h2>Final word</h2>
<p><a href="/demos/css-dropdown/" class="hilite demo-link">View demo&hellip;</a></p>
<p>So, there you have it. A simple concept pulled off with some very lean markup and some clever CSS and progressive enhancement. It&#8217;s totally accessible, the markup is semantic and sensible and it relies on no weighty Javascript libraries to work.</p>
<p>Hopefully my write-up makes sense. but if anything is unclear leave a comment and one of us in <a href="http://twitter.com/VenturelabDev">the dev team</a> will try and set you right. Or, you could just copy/paste the code and hack it apart for yourselves.</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2011/02/creating-a-pure-css-dropdown-menu/feed/</wfw:commentRss>
		<slash:comments>84</slash:comments>
		</item>
		<item>
		<title>Pure CSS(3) accordion</title>
		<link>http://csswizardry.com/2011/02/pure-css3-accordion/</link>
		<comments>http://csswizardry.com/2011/02/pure-css3-accordion/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 09:32:39 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=2538</guid>
		<description><![CDATA[I tend to do a lot of tinkering with code, and came up with something that&#8217;s not so new, but still, in my opinion, pretty cool. An accordion using nothing but semantic HTML, CSS and some nice progressive CSS3. There are also two versions, a horizontal one and a vertical one.
Demo
This article has been ported [...]]]></description>
			<content:encoded><![CDATA[<p>I tend to do a lot of tinkering with code, and came up with something that&#8217;s not so new, but still, in my opinion, pretty cool. An accordion using nothing but semantic HTML, CSS and some nice progressive CSS3. There are also two versions, a horizontal one and a vertical one.</p>
<h2><a href="http://csswizardry.com/demos/accordion/">Demo</a></h2>
<p class="info-message">This article has been ported from the now-defunct Venturelab Devblog, where I had originally authored it.</p>
<p><span id="more-2538"></span></p>
<h2>Horizontal accordion</h2>
<p>Let&#8217;s start with the markup for the horizontal accordion, it&#8217;s really nothing special, just some good ol&#8217; semantic HTML:</p>
<pre><code>&lt;ul class=&quot;accordion&quot;&gt;

  &lt;li class=&quot;slide-01&quot;&gt;

    &lt;div&gt;

      &lt;h2&gt;Slide one&lt;/h2&gt;

      &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse id lobortis massa. Nunc viverra velit leo, sit amet elementum mi. Fusce posuere nunc a mi tempus malesuada. Curabitur facilisis rhoncus eros eget placerat. Aliquam semper mauris sit amet justo tempor nec lacinia magna molestie. Etiam placerat congue dolor vitae adipiscing. Aliquam ac erat lorem, ut iaculis justo. Etiam mattis dignissim gravida. Aliquam nec justo ante, non semper mi. Nulla consectetur interdum massa, vel porta enim vulputate sed. Maecenas elit quam, egestas eget placerat non, fringilla vel eros. Nam vehicula elementum nulla sed consequat. Phasellus eu erat enim. Praesent at magna non massa dapibus scelerisque in eu lorem.&lt;/p&gt;

    &lt;/div&gt;

  &lt;/li&gt;

  &lt;li class=&quot;slide-02&quot;&gt;

    &lt;div&gt;

      &lt;h2&gt;Slide two&lt;/h2&gt;

      &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse id lobortis massa. Nunc viverra velit leo, sit amet elementum mi. Fusce posuere nunc a mi tempus malesuada. Curabitur facilisis rhoncus eros eget placerat. Aliquam semper mauris sit amet justo tempor nec lacinia magna molestie. Etiam placerat congue dolor vitae adipiscing. Aliquam ac erat lorem, ut iaculis justo. Etiam mattis dignissim gravida. Aliquam nec justo ante, non semper mi. Nulla consectetur interdum massa, vel porta enim vulputate sed. Maecenas elit quam, egestas eget placerat non, fringilla vel eros. Nam vehicula elementum nulla sed consequat. Phasellus eu erat enim. Praesent at magna non massa dapibus scelerisque in eu lorem.&lt;/p&gt;

    &lt;/div&gt;

  &lt;/li&gt;

  &lt;li class=&quot;slide-03&quot;&gt;

    &lt;div&gt;

      &lt;h2&gt;Slide three&lt;/h2&gt;

      &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse id lobortis massa. Nunc viverra velit leo, sit amet elementum mi. Fusce posuere nunc a mi tempus malesuada. Curabitur facilisis rhoncus eros eget placerat. Aliquam semper mauris sit amet justo tempor nec lacinia magna molestie. Etiam placerat congue dolor vitae adipiscing. Aliquam ac erat lorem, ut iaculis justo. Etiam mattis dignissim gravida. Aliquam nec justo ante, non semper mi. Nulla consectetur interdum massa, vel porta enim vulputate sed. Maecenas elit quam, egestas eget placerat non, fringilla vel eros. Nam vehicula elementum nulla sed consequat. Phasellus eu erat enim. Praesent at magna non massa dapibus scelerisque in eu lorem.&lt;/p&gt;

    &lt;/div&gt;

  &lt;/li&gt;

  &lt;li class=&quot;slide-04&quot;&gt;

    &lt;div&gt;

      &lt;h2&gt;Slide four&lt;/h2&gt;

      &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse id lobortis massa. Nunc viverra velit leo, sit amet elementum mi. Fusce posuere nunc a mi tempus malesuada. Curabitur facilisis rhoncus eros eget placerat. Aliquam semper mauris sit amet justo tempor nec lacinia magna molestie. Etiam placerat congue dolor vitae adipiscing. Aliquam ac erat lorem, ut iaculis justo. Etiam mattis dignissim gravida. Aliquam nec justo ante, non semper mi. Nulla consectetur interdum massa, vel porta enim vulputate sed. Maecenas elit quam, egestas eget placerat non, fringilla vel eros. Nam vehicula elementum nulla sed consequat. Phasellus eu erat enim. Praesent at magna non massa dapibus scelerisque in eu lorem.&lt;/p&gt;

    &lt;/div&gt;

  &lt;/li&gt;

  &lt;li class=&quot;slide-05&quot;&gt;

    &lt;div&gt;

      &lt;h2&gt;Slide five&lt;/h2&gt;

      &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse id lobortis massa. Nunc viverra velit leo, sit amet elementum mi. Fusce posuere nunc a mi tempus malesuada. Curabitur facilisis rhoncus eros eget placerat. Aliquam semper mauris sit amet justo tempor nec lacinia magna molestie. Etiam placerat congue dolor vitae adipiscing. Aliquam ac erat lorem, ut iaculis justo. Etiam mattis dignissim gravida. Aliquam nec justo ante, non semper mi. Nulla consectetur interdum massa, vel porta enim vulputate sed. Maecenas elit quam, egestas eget placerat non, fringilla vel eros. Nam vehicula elementum nulla sed consequat. Phasellus eu erat enim. Praesent at magna non massa dapibus scelerisque in eu lorem.&lt;/p&gt;

    &lt;/div&gt;

  &lt;/li&gt;

&lt;/ul&gt;</code></pre>
<p>Here we have a simple unordered list containing a series of class-named list items and some content. Simple. The CSS is where it gets nifty:</p>
<pre><code><span class="code-comment">/*------------------------------------*\
  ACCORDION
\*------------------------------------*/</span>
.accordion{
  width:940px;
  overflow:hidden;
  list-style:none;
  margin-bottom:10px;
  text-shadow:1px 1px 1px rgba(0,0,0,0.25);
  background:blue;

  -moz-border-radius:10px;
  -webkit-border-radius:10px;
  -o-border-radius:10px;
  border-radius:10px;
}
.accordion li{
  float:left;
  width:20%;
  overflow:hidden;
  height:250px;
  -moz-transition:width 0.2s ease-out;
  -webkit-transition:width 0.2s ease-out;
  -o-transition:width 0.2s ease-out;
  transition:width 0.2s ease-out;
  -moz-transition-delay:0.15s;
  -webkit-transition-delay:0.15s;
  -o-transition-delay:0.15s;
  transition-delay:0.15s;
}
.accordion li:first-of-type{
  -moz-border-radius:10px 0 0 10px;
  -webkit-border-radius:10px 0 0 10px;
  -o-border-radius:10px 0 0 10px;
  border-radius:10px 0 0 10px;
}
.accordion li:last-of-type{
  -moz-border-radius:0 10px 10px 0;
  -webkit-border-radius:0 10px 10px 0;
  -o-border-radius:0 10px 10px 0;
  border-radius:0 10px 10px 0;
}
.accordion div{
  padding:10px;
}
.accordion:hover li{
  width:10%;
}
.accordion li:hover{
  width:60%;
}
.slide-01  { background:red; color:white; }
.slide-02  { background:orange; color:white; }
.slide-03  { background:yellow; color:#333; text-shadow:none; }
.slide-04  { background:green; color:white; }
.slide-05  { background:blue; color:white; }</code></pre>
<p>It&#8217;s all fairly self-explanatory; first we have the <code>.accordion</code> class for the <code>&lt;ul&gt;</code> where we define a width and overflow hidden (<a href="http://csswizardry.com/floats/">to clear floats</a>) and some other bits and pieces.</p>
<p>Next we float the list items left so they all stack up, give them a width of 20% (<strong>100% &divide; 5 = 20%</strong>) and give them <code>overflow:hidden;</code> so that no content breaks out of them. We also apply a fixed height that will nicely house all the content once the list items expand.</p>
<p>Now here&#8217;s a progressive bit, we tell the list items to transition their widths over a period of 0.2 seconds, easing out the animation.</p>
<p>Then after this we use the very handy <code>:first-</code> and <code>:last-of-type</code> selectors to round the top- and bottom-left and top- and bottom-right corners of the first and last list items respectively.</p>
<p>After this, we have a <code>&lt;div&gt;</code> to which we apply 10px padding. You could argue that this <code>&lt;div&gt;</code> is extraneous and that we can simply add the padding to the <code>&lt;li&gt;</code>s, and you&#8217;d be right, however this would make the percentage numbers for the width less nice to work with if you have to factor in paddings on the list items too.</p>
<p>Now we reach the bit that makes the accordion functional:</p>
<pre><code>.accordion:hover li{
  width:10%;
}</code></pre>
<p>What we do here is say <em>as soon as I hover the &lt;ul&gt; make all the &lt;li&gt;s 10% in width</em>.</p>
<p>This gives us <strong>5 &times; 10% = 50%</strong>. 5 lots of 10% width list items in the list. We have a spare 50% of extra space in the list that we&#8217;d like to fill with whatever list item we are currently hovering.</p>
<p><strong>10% list item + 50% dead space to fill = 60%</strong></p>
<p>So what we do now is say <em>make the list item that I am actually hovering 60% width</em>.</p>
<pre><code>.accordion li:hover{
  width:60%;
}</code></pre>
<p>The whole functionality says <em>when I hover the list make every list item 10% the width of the <code>&lt;ul&gt;</code> but make the one <code>&lt;li&gt;</code> that my cursor is over 60% of the width</em>.</p>
<p><strong>10% + 10% + 10% + 10% + 60% = 100%</strong></p>
<p>The final block simply gives the list items some colour (colours of the rainbow, did you notice?).</p>
<p>When it&#8217;s all tied together you get a series of list items that alter their widths when hovered (but always totalling 100%). Then we use some CSS3 to round the corners in supportive browsers, and some transitions for the even more supportive browsers. This leaves us with an sliding accordion of rich HTML content that uses no JS and works even in IE7.</p>
<h2>Vertical accordion</h2>
<p>Just for an optional extra I decided to make the accordion work in a vertical orientation. We use exactly the same markup save for adding an ID to the <code>&lt;ul&gt;</code>, thus:</p>
<pre><code>&lt;ul class=&quot;accordion&quot; id=&quot;vertical&quot;&gt;</code></pre>
<p>Now we stack the list items on top of one another by giving them a 100% width and this time applying the same 10% / 60% logic to the heights instead. The following code is all very self-explanatory so I&#8217;ll just leave you with it:</p>
<pre><code><span class="code-comment">/*------------------------------------*\
  VERTICAL
\*------------------------------------*/</span>
#vertical{
  height:300px;
}
#vertical li{
  float:none;
  height:20%;
  width:100%;
  -moz-transition:height 0.2s ease-out;
  -webkit-transition:height 0.2s ease-out;
  -o-transition:height 0.2s ease-out;
  transition:height 0.2s ease-out;
}
#vertical li:first-of-type{
  -moz-border-radius:10px 10px 0 0;
  -webkit-border-radius:10px 10px 0 0;
  -o-border-radius:10px 10px 0 0;
  border-radius:10px 10px 0 0;
}
#vertical li:last-of-type{
  -moz-border-radius:0 0 10px 10px;
  -webkit-border-radius:0 0 10px 10px;
  -o-border-radius:0 0 10px 10px;
  border-radius:0 0 10px 10px;
}
#vertical:hover li{
  height:10%;
  width:100%;
}
#vertical li:hover{
  height:60%;
  width:100%;
}</code></pre>
<p>As we are inheriting the code from the horizontal version we do have to override the <code>:hover</code> state&#8217;s widths by explicitly setting them to 100%, but aside from that pretty much all we&#8217;ve done is applied the above theory to heights as opposed to widths. Magic!</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2011/02/pure-css3-accordion/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>CSS powered ribbons the clean way</title>
		<link>http://csswizardry.com/2011/02/css-powered-ribbons-the-clean-way/</link>
		<comments>http://csswizardry.com/2011/02/css-powered-ribbons-the-clean-way/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 12:48:01 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Markup]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=2469</guid>
		<description><![CDATA[I&#8217;ve started buying .net magazine again recently. I don&#8217;t normally but I was hoping it might help in my search for a super-awesome new agency. I was flicking through this month&#8217;s edition when I happened upon a Create a wraparound ribbon tutorial. I thought I&#8217;d give it a read as I really love little design [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started buying <a href="http://www.netmag.co.uk/">.net magazine</a> again recently. I don&#8217;t normally but I was hoping it might help in <a href="http://csswizardry.com/2011/02/hire-me/">my search for a super-awesome new agency</a>. I was flicking through this month&#8217;s edition when I happened upon a <cite>Create a wraparound ribbon</cite> tutorial. I thought I&#8217;d give it a read as I really love little design conundrums and how other people solve them. I was a little surprised to see it had been done in five elements. I challenged myself to do it in one&#8230;</p>
<p><span id="more-2469"></span></p>
<p><img src="http://csswizardry.com/wp-content/uploads/2011/02/ribbon-example.gif" alt="Ribbon example" class="left" /></p>
<p>Okay, so I can&#8217;t re-publish or copy sections of the article but you can either buy .net and read it, or look at the tiny images on <a href="http://www.netmag.co.uk/zine/latest-issue/issue-212">the latest issue page</a>. It simply creates what is in the screenshot&mdash;a ribbon-like effect that sits outside and then &#8216;behind&#8217; its content.</p>
<p>I&#8217;m not bashing the author&#8217;s work at all. It works and is&mdash;as far as I can see&mdash;pretty robust. However, it certainly doesn&#8217;t need five elements and <em>definitely</em> no empty ones. His code was roughly:</p>
<pre><code>&lt;body&gt;

  &lt;wrapper&gt;
    &lt;wrapper&gt;
      &lt;wrapper&gt;
        &lt;h2&gt;&lt;/h2&gt;
      &lt;/wrapper&gt;
      &lt;empty&gt;&lt;/empty&gt;
    &lt;/wrapper&gt;
  &lt;/wrapper&gt;

&lt;/body&gt;</code></pre>
<p>Mine is:</p>
<pre><code>&lt;body&gt;

  &lt;h2&gt;&lt;/h2&gt;

&lt;/body&gt;</code></pre>
<p>And it does <em>exactly the same thing</em>. The CSS that powers the original makes use of <a href="http://jonrohan.me/guide/css/creating-triangles-in-css/">manipulating the CSS borders-arrow behaviour</a>. I opted for a good old fashioned image. There&#8217;s nothing wrong with the border-arrow method but I&#8217;m orthodox, and manipulating borders to create what is essentially an image just feels really wrong to me. Use whichever you prefer, but remember that <em>images still count</em>!</p>
<p>The full code for my CSS powered ribbon is simply:</p>
<pre><code><span class="code-comment">&lt;!-- MARKUP --&gt;</span>
&lt;body&gt;
  &lt;h2&gt;&lt;/h2&gt;
&lt;/body&gt;

<span class="code-comment">/* CSS */</span>

<span class="code-comment">/*------------------------------------*\
	MAIN
\*------------------------------------*/</span>
html{
	font-family:Cambria, Georgia, &quot;Times New Roman&quot;, Times, serif;
	background:#e4e3d5;
	color:#666;
	height:101%;
}
body{
	width:940px;
	padding:75px 10px;
	margin:0 auto;
	background:#fff;
}

<span class="code-comment">/*------------------------------------*\
	TYPE
\*------------------------------------*/</span>
h2{
	position:relative;
	color:#fff;
	background:#f43059;
	font-size:1.5em;
	float:left;
	clear:both;
	padding:10px 10px 10px 20px;
	margin-left:-20px;
	margin-bottom:20px;
	text-shadow:0 -1px #d0284b, 0 1px #f96080;

	-moz-box-shadow:2px 2px 0 rgba(0,0,0,0.1);
	-webkit-box-shadow:2px 2px 0 rgba(0,0,0,0.1);
	-o-box-shadow:2px 2px 0 rgba(0,0,0,0.1);
	box-shadow:2px 2px 0 rgba(0,0,0,0.1);
}
h2:before{
	content:&quot; &quot;;
	background:url(../img/css/ribbon.png);
	display:block;
	width:10px;
	height:10px;
	position:absolute;
	bottom:0;
	left:0;
	margin-bottom:-10px;
	z-index:-1;
}</code></pre>
<p>There we have it in four less elements. His five (discounting the <code>&lt;body&gt;</code>) to my one <code>&lt;h2&gt;</code>. 80% less code.</p>
<p>What this does is creates a white <code>&lt;h2&gt;</code> with a pink background, pulls the <code>&lt;h2&gt;</code> out of the content area with a negative margin and then places the image absolutely left-bottom of the <code>&lt;h2&gt;</code> in a <code>:before</code> pseudo-element. Job done.</p>
<h2><a href="/demos/css-powered-ribbons/">Demo</a></h2>
<p>I made <a href="/demos/css-powered-ribbons/">a demo</a>, also, which shows how this can be extended using some alternating <code>nth-of-type</code> styles. Feel free to pick it apart and see what does what. If any of the examples above seems out of context then view <a href="http://csswizardry.com/demos/css-powered-ribbons/css/style.css">the demo&#8217;s stylesheet</a> and source for the comprehensive code.</p>
<h2>Final word</h2>
<p>This works in IE 7 (without the <code>:before</code> and <code>:after</code> pseudo-elements), IE8, Firefox and Chrome, all with varying degrees of progressively enhanced niceties. Your code should never suffer for the sake of such tiny design elements. Keep it lean and use an aggressive approach to progressive enhancement in order to keep your markup at its best.</p>
<h3>Final final word</h3>
<p>This isn&#8217;t a dig at the author of the article <em>or</em> .net mag. This is simply an illustration of how progressive enhancement and some sensibility can solve the same problem in a far nicer, cleaner and more sensible fashion.</p>
<p>Furthermore, do feel free to use either the border &#8216;hack&#8217; or the image method. There&#8217;s more than one way to skin a cat&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2011/02/css-powered-ribbons-the-clean-way/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Link: Recreating the Luke&#8217;s Beard social icons with CSS3</title>
		<link>http://csswizardry.com/2011/01/link-recreating-the-lukes-beard-social-icons-with-css3/</link>
		<comments>http://csswizardry.com/2011/01/link-recreating-the-lukes-beard-social-icons-with-css3/#comments</comments>
		<pubDate>Sun, 23 Jan 2011 16:55:38 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=2258</guid>
		<description><![CDATA[I was browsing Dribbble this afternoon when I came across Luke&#8217;s Beard profile and then, in turn, his website. I noticed some pretty cool hover effects going on with his social icons which I decided to recreate without JavaScript and using some progressive CSS.
Demo
I won&#8217;t write everything up because a view of the source and [...]]]></description>
			<content:encoded><![CDATA[<p>I was browsing <a href="http://dribbble.com/csswizardry">Dribbble</a> this afternoon when I came across <a href="http://dribbble.com/lukesbeard/">Luke&#8217;s Beard profile</a> and then, in turn, <a href="http://www.lukesbeard.com/">his website</a>. I noticed some pretty cool hover effects going on with his social icons which <a href="http://csswizardry.com/demos/lukes-beard-social-icons/">I decided to recreate without JavaScript and using some progressive CSS</a>.</p>
<h2><a href="/demos/lukes-beard-social-icons/">Demo</a></h2>
<p>I won&#8217;t write everything up because a view of the source and <a href="http://csswizardry.com/demos/lukes-beard-social-icons/css/style.css">CSS</a> should explain everything.</p>
<p>Luke did not commission this work, so please don&#8217;t reuse the icons or copy this without permission from the respective people. I allow full use of my code (with attribution) but please don&#8217;t copy Luke&#8217;s format for social icons&mdash;the code is mine but its implementation on social icons is Luke&#8217;s.</p>
<p class="info-message">In short, you can have my code but it was Luke&#8217;s idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2011/01/link-recreating-the-lukes-beard-social-icons-with-css3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Let it snow!</title>
		<link>http://csswizardry.com/2010/12/let-it-snow/</link>
		<comments>http://csswizardry.com/2010/12/let-it-snow/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 19:35:31 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=1817</guid>
		<description><![CDATA[Remember the snowy websites of the late 90s? The ones that cropped up around Christmas time and probably had a sleigh following the mouse cursor? Me too; horrible weren&#8217;t they? However&#8212;given the recent weather the UK has had&#8212;I have decided to give them a 2010 revival. That is to say no nasty Javascript, and some [...]]]></description>
			<content:encoded><![CDATA[<p><span class="opener"><span>R</span>emember</span> the snowy websites of the late 90s? The ones that cropped up around Christmas time and probably had a sleigh following the mouse cursor? Me too; horrible weren&#8217;t they? However&mdash;given <a href="http://www.bbc.co.uk/news/uk-scotland-11901718">the recent weather the UK has had</a>&mdash;I have decided to give them a 2010 revival. That is to say no nasty Javascript, and some not-too-unsightly markup! <a href="/demos/snow/">Without further ado: Let it snow!</a></p>
<h2>Demo</h2>
<p class="marginalia">We also have <a href="/demos/snow/?time=day">a daytime version</a>!</p>
<p>First off, <a href="/demos/snow/">look at the demo</a> in IE8 or Firefox, <em>then</em> in Chrome or Safari (i.e. non-Webkit, then Webkit).</p>
<p>In Firefox you should see a series of snowflakes randomly sized and placed across the screen. In Webkit, you should see these snowflakes falling, all at different speeds. We also have a <code>repeat-x</code> background image of some snow running across the bottom of the browser window.</p>
<h2>The code</h2>
<p>We use a lot of PHP to create the random effects applied to the snowflakes, and also automate a lot of the legwork needed to create 65 unique classes, it&#8217;s commented as shown and should make total sense.</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
  &lt;title&gt;Let it snow&lt;/title&gt;
  &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/style.css&quot; /&gt;
  &lt;style type=&quot;text/css&quot;&gt;

    &lt;?php <span class="code-comment">//If the day parameter is set, use a different background</span> ?&gt;
    &lt;?php if(isset($_GET['time']) &#038;&#038; $_GET['time'] == 'day') { ?&gt;
    html{
      background:url(img/css/snow.png) bottom left repeat-x fixed #b4c8cc;
    }
    &lt;?php } ?&gt;

    &lt;?php <span class="code-comment">//Number of snowflakes -- you decide!</span> ?&gt;
    &lt;?php $snowflakeCount = 65;  ?&gt;

    &lt;?php <span class="code-comment">//Create a unique class for each of the snowflakes and assign each one a random size and animation duration</span> ?&gt;
    &lt;?php  for($i = 1; $i &lt;= $snowflakeCount; $i++) { ?&gt;
      .snowflake-&lt;?php echo $i ?&gt;{
        &lt;?php <span class="code-comment">//Create a random decimal number between 1 and 10:</span> ?&gt;
        -webkit-animation-duration:&lt;?php echo (rand(10,100) / 10); ?&gt;s;
        &lt;?php <span class="code-comment">//Create a random decimal number between 0.1 and 2:</span> ?&gt;
        font-size:&lt;?php echo (rand(1,20) / 10); ?&gt;em;
      }
    &lt;?php } ?&gt;
  &lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

  &lt;div id=&quot;wrapper&quot;&gt;
    &lt;h1&gt;Let it snow!&lt;/h1&gt;
    &lt;p&gt;&lt;a href=&quot;/2010/12/let-it-snow/&quot;&gt;Return to article.&lt;/a&gt;&lt;/p&gt;
  &lt;/div&gt;

  &lt;div id=&quot;snow&quot;&gt;
    &lt;?php <span class="code-comment">//Loop through your chosen amount of snowflakes and make that many empty spans (with associated class) and randomly place them on-screen</span> ?&gt;
    &lt;?php for($i = 1; $i &lt;= $snowflakeCount; $i++) { ?&gt;
      &lt;span class=&quot;snowflake snowflake-&lt;?php echo $i; ?&gt;&quot; style=&quot;top:&lt;?php echo rand(1,98); ?&gt;%; left:&lt;?php echo rand(1,98); ?&gt;%&quot;&gt;&lt;/span&gt;
    &lt;?php  } ?&gt;
  &lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>Basically we use PHP to create 65 empty <code>&lt;span&gt;</code>s which are then randomly placed and sized on the page. We also give each one a random <code>-webkit-animation-duration</code> so as to ensure they fall at different speeds. Two points worth noting:</p>
<pre><code>&lt;?php <span class="code-comment">//Create a random decimal number between 1 and 10:</span> ?&gt;
-webkit-animation-duration:&lt;?php echo (rand(10,100) / 10); ?&gt;s;
&lt;?php <span class="code-comment">//Create a random decimal number between 0.1 and 2:</span> ?&gt;
font-size:&lt;?php echo (rand(1,20) / 10); ?&gt;em;</code></pre>
<p class="marginalia">Thanks to <a href="http://twitter.com/punch_n_pie">Dan Bentley</a> for his PHP input here-and-there&mdash;mine is a tad rusty.</p>
<p>Here we use <code>rand(10,100)</code> to create a random <em>whole</em> number between ten and one hundred (let&#8217;s say 75). We then divide this by ten to get a decimal (i.e. 7.5) to use as the duration in seconds.<br />
We then use <code>rand(1,20)</code> to create a random number between one and twenty (say, 5) which we then divide by ten to get a decimal (i.e. 0.5) for the <code>font-size</code> in ems.</p>
<h3>The CSS</h3>
<pre><code><span class="code-comment">/*------------------------------------*\
  MAIN
\*------------------------------------*/</span>
html{
  font-family:Calibri, Arial, Verdana, sans-serif;
  background:url(../img/css/snow.png) bottom left repeat-x fixed #222;
  color:#fff;
  text-shadow:1px 1px 1px rgba(0,0,0,0.5);
  height:101%;
}
body{
  width:940px;
  padding:10px;
  margin:0 auto;
}
#wrapper{
  position:relative;
  z-index:5; <span class="code-comment">/* Bring the content over the snowflakes */</span>
}
h1{
  font-weight:bold;
  font-size:1.5em;
  margin-bottom:20px;
}
a{
  color:#fff;
}

<span class="code-comment">/*------------------------------------*\
  SNOWFLAKES
\*------------------------------------*/</span>
<span class="code-comment">/* Set up a blank canvas in which to house the snowflakes */</span>
#snow{
  position:fixed;
  top:0;
  right:0;
  bottom:0;
  left:0;
  overflow:hidden;
}
.snowflake{
  text-shadow:none;
  position:absolute;
  top:0;
  <span class="code-comment">/* Set up the animation */</span>
  -webkit-animation-name:snowflake-animation;
  -webkit-animation-iteration-count:infinite;
  -webkit-animation-timing-function:linear;
}
<span class="code-comment">/* Fill the empty span with a snowflake-like asterisk */</span>
.snowflake:before{
  content:&quot;*&quot;;
}
@-webkit-keyframes snowflake-animation{
  <span class="code-comment">/* Start at the top */</span>
  from{
    top:0%;
    -webkit-transform:rotate(0deg);
  }
  <span class="code-comment">/* Rotate by 360 degrees up until the half way point */</span>
  50%{
    -webkit-transform:rotate(360deg);
  }
  <span class="code-comment">/* Animate to the bottom whilst rotating back to zero */</span>
  to{
    top:100%;
    -webkit-transform:rotate(0deg);
  }
}</code></pre>
<p>The CSS, again, is extremely straightforward and self-explanatory. <a href="/2010/09/keeping-code-clean-with-content/">Use <code>content:&quot;&quot;;</code> to keep our code a little cleaner</a>, and animate all the snowflakes top-to-bottom whilst rotating them. Simple!</p>
<p>So there we&#8217;ve put a new-age spin on a very dated (and still pretty garish) technique.</p>
<h2><ins datetime="2010-12-02T20:15:14+00:00">Addendum</ins></h2>
<p>Following <a href="http://twitter.com/csswizardry/statuses/10425282116722688">this Twitter conversation</a> between <a href="http://twitter.com/dbanksDesign">Danny Banks</a> and myself the <code>#snow</code> <code>&lt;div&gt;</code> was introduced. Cheers for the heads-up, <a href="http://twitter.com/dbanksDesign">Danny</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2010/12/let-it-snow/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Improving CSS tooltips</title>
		<link>http://csswizardry.com/2010/11/improving-css-tooltips/</link>
		<comments>http://csswizardry.com/2010/11/improving-css-tooltips/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 23:55:27 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=1805</guid>
		<description><![CDATA[But only very slightly&#8230; Jack Osborne, whom I have followed on Twitter for a while now, posted some time ago a tooltip tutorial whereby you utilise the :after CSS pseudo-element and the attr() function to populate it. His method works by giving an element a title="" attribute and a class of tooltip, and placing the [...]]]></description>
			<content:encoded><![CDATA[<p><span class="opener"><span>B</span>ut</span> only very slightly&#8230; <a href="http://twitter.com/jackosborne">Jack Osborne</a>, whom I have followed on Twitter for a while now, posted some time ago <a href="http://jackosborne.co.uk/articles/css-tooltips-with-the-pseudo-element/">a tooltip tutorial</a> whereby you utilise the <code>:after</code> CSS pseudo-element and the <code>attr()</code> function to populate it. His method works by giving an element a <code>title=""</code> attribute and a class of <code>tooltip</code>, and placing the content of the title attribute after the content, all through CSS.</p>
<p>The only <em>technical</em> downside I can see here is the necessity for that class. Using a simple attribute selector we can ditch that and basically say &#8216;if any element has a title, put that title after it in CSS&#8217;. By simply using <code>[title]</code> over <code>.tooltip</code> we can automate the process and trim some bytes, thus:</p>
<pre><code>&lt;a href=&quot;http://twitter.com/jackosborne&quot; title=&quot;Follow Jack Osborne on Twitter&quot;&gt;Jack Osborne&lt;/a&gt;

[title]{
	position:relative;
}
[title]:after{
	content:attr(title);
	color:#fff;
	background:#333;
	background:rgba(51,51,51,0.75);
	padding:5px;
	position:absolute;
	left:-9999px;
	opacity:0;
	bottom:100%;
	white-space:nowrap;
	-webkit-transition:0.25s linear opacity;
}
[title]:hover:after{
	left:5px;
	opacity:1;
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2010/11/improving-css-tooltips/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Mark up a semantic, accessible, progressively enhanced, mobile optimised progress bar (bonus: style the numbers in an ordered list!)</title>
		<link>http://csswizardry.com/2010/11/mark-up-a-semantic-accessible-progressively-enhanced-mobile-optimised-progress-bar-bonus-style-the-numbers-in-an-ordered-list/</link>
		<comments>http://csswizardry.com/2010/11/mark-up-a-semantic-accessible-progressively-enhanced-mobile-optimised-progress-bar-bonus-style-the-numbers-in-an-ordered-list/#comments</comments>
		<pubDate>Wed, 17 Nov 2010 18:27:32 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Markup]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>
		<category><![CDATA[Semantics]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=1711</guid>
		<description><![CDATA[How about that for an over-the-top title? But it&#8217;s true, that&#8217;s what we&#8217;re going to be doing. It&#8217;s been a while since my last post, unfortunately, so I thought I&#8217;d make up for it with this sizeable offering in which we will learn a lot of really great techniques in order to make something as [...]]]></description>
			<content:encoded><![CDATA[<p><span class="opener"><span>H</span>ow</span> about that for an over-the-top title? But it&#8217;s true, that&#8217;s what we&#8217;re going to be doing. It&#8217;s been a while since my last post, unfortunately, so I thought I&#8217;d make up for it with this sizeable offering in which we will learn a lot of really great techniques in order to make something as simple as a progress bar. By which I mean a breadcrumb-esque meter of steps, such as you might find on a checkout process; we are making <a href="/demos/progress-bar/">this</a>:</p>
<p><a href="/demos/progress-bar/" style="background:none;"><img src="http://csswizardry.com/wp-content/uploads/2010/11/progress.jpg" alt="Screenshot of the final product." class="full" /></a></p>
<p><span id="more-1711"></span></p>
<p>And in doing so we will cover:</p>
<ul>
<li><a href="#section-design-build">Design and build a semantic, accessible and sensible progress bar.</a></li>
<li><a href="#section-body-id">Utilise the much underused method of styling page-specific elements based on their IDs.</a></li>
<li><a href="#section-numbers">Style the numbers in an ordered list!</a></li>
<li><a href="#section-progressive">Progressively enhance it with some CSS3.</a></li>
<li><a href="#section-mobile">Optimise it for mobile.</a></li>
</ul>
<p class="marginalia"><strong>N.B.</strong> This article isn&#8217;t so much about a progress bar, but more an illustration that best practices and more advanced techniques can be applied to even the most insignificant aspects of a build to create something awesome!</p>
<h2 id="section-design-build">Design and build</h2>
<p>Let us assume the brief is this:</p>
<p>We require a numbered progress bar to indicate user location (past, current and future) during a checkout path on the OurService&trade; website. It must:</p>
<ul>
<li>Be fully accessible.</li>
<li>Provide a section title with supporting information.</li>
<li>Highlight the user&#8217;s current location in the process.</li>
<li>Be navigable.</li>
<li>Work on mobile devices.</li>
</ul>
<p>The design, let&#8217;s assume, is predefined. It looks as above, purely because it has to. The design is not the major focus of this article, the code and techniques are.</p>
<blockquote><p>&#8220;Code what you consume, not what you see.&#8221;</p>
</blockquote>
<h3>Design</h3>
<p>The progress bar shall be a linear, left to right series of linked labels. Current location shall be indicated by a change in colour, progression onto the next step shall be indicated by an arrow.</p>
<h3>Build</h3>
<p class="marginalia">For the purposes of this tutorial we shall assume the current page is the payment page.</p>
<p>One school of though I find invaluable when it comes to sensible and semantic builds is <q>code what you consume, not what you see</q>. This is a very broad generalisation but works for the most part. Code content independently of (and before you consider) coding any styles. Web development basics, but fundamental to web standards and progressive enhancement.</p>
<p>So, what are we consuming? It&#8217;s an ordered list of steps which indicate location in a process.</p>
<p>Okay so first off we know we need an <code>&lt;ol&gt;</code> as this list has fixed and definite order. We also require titles and supporting copy for each item. As the titles and supporting copy require separation from one another we are going to wrap the titles in a <code>&lt;span&gt;</code>; a generic inline container. This leaves us with:</p>
<pre><code>&lt;body id=&quot;payment-page&quot;&gt;

  &lt;ol id=&quot;progress&quot;&gt;

    &lt;li class=&quot;details-step&quot;&gt;
      &lt;a href=&quot;#&quot;&gt;
        &lt;span&gt;Your details&lt;/span&gt;
        Name, email, address.
      &lt;/a&gt;
    &lt;/li&gt;

    &lt;li class=&quot;account-step&quot;&gt;
      &lt;a href=&quot;#&quot;&gt;
        &lt;span&gt;Create account&lt;/span&gt;
        Username and custom URL.
      &lt;/a&gt;
    &lt;/li&gt;

    &lt;li class=&quot;products-step&quot;&gt;
      &lt;a href=&quot;#&quot;&gt;
        &lt;span&gt;Product options&lt;/span&gt;
        Choose your package.
      &lt;/a&gt;
    &lt;/li&gt;

    &lt;li class=&quot;payment-step&quot;&gt;
      &lt;a href=&quot;#&quot;&gt;
        &lt;strong&gt;
          &lt;span&gt;Payment&lt;/span&gt;
          PayPal, or credit card.
        &lt;/strong&gt;
      &lt;/a&gt;
    &lt;/li&gt;

    &lt;li class=&quot;go-step&quot;&gt;
      &lt;a href=&quot;#&quot;&gt;
        &lt;span&gt;Go!&lt;/span&gt;
        Start using OurService&trade;
      &lt;/a&gt;
    &lt;/li&gt;

  &lt;/ol&gt;

&lt;/body&gt;</code></pre>
<p>There are a few things in this code which I&#8217;ve not yet mentioned, one is the ID on the <code>&lt;body&gt;</code>, another being the class on each <code>&lt;li&gt;</code> and the last being the <code>&lt;strong&gt;</code> wrapped around the payment page&#8217;s text. I shall explain these next.</p>
<h4 id="section-body-id"><code>&lt;body&gt;</code> ID and list item classes</h4>
<p>A combination of an ID on the <code>&lt;body&gt;</code> and a class on a list item can allow you to know what the current page is. The CSS <code>#payment-page .payment-step{}</code> will target the payment section of the progress bar when it is on the payment page in the process. Similarly, <code>#go-page .go-step{}</code> will target the go item on the go page. I wrote <a href="http://www.venturelab.co.uk/devblog/2010/06/body-idsmaking-life-easier-for-yourself/">a much more in-depth article</a> on this over at <a href="http://www.venturelab.co.uk/">Venturelab</a>.</p>
<h4>The <code>&lt;strong&gt;</code> around the payment step&#8217;s text</h4>
<p class="marginalia">If you&#8217;re determining current page programatically, one could argue inserting a <code>class=&quot;current&quot;</code> on the relevant item. This is doable, but avoiding such a class name is far nicer.</p>
<p>As stated earlier we are assuming the current page to be the payment page. Now, we can style the current step on any page using CSS, as outlined above, however how would a user with styles disabled be able to tell what the current page is? How can we highlight this for those users?</p>
<p>Well the solution would be to programatically wrap a <code>&lt;strong&gt;</code> around the text on that page, undo the bolding effects with CSS for browsers with styles enabled, and allow people viewing unstyled content to see that the bolded item is the current page. This gives us:</p>
<p><img src="http://csswizardry.com/wp-content/uploads/2010/11/progress-unstyled.jpg" alt="Unstyled progress bar" class="left outdent" /></p>
<p>As you can see, users with styles disabled can clearly see the current link is the bolded one, this makes the progress bar that little bit more  accessible to those who might need it.</p>
<p>So there we have it, the markup that powers the whole thing.</p>
<div class="hr">
<hr /></div>
<h2>Styling</h2>
<p>Now to style this thing up. First off we&#8217;ll look at the very basic CSS, and that alone:</p>
<pre><code><span class="code-comment">/*------------------------------------*\
  MAIN
\*------------------------------------*/</span>
html{
  height:101%;
}
body{
  font-family:Calibri, Arial, Verdana, sans-serif;
  background:#fff;
  color:#88979e;
  width:940px;
  padding:10px;
  margin:0 auto;
}

<span class="code-comment">/*------------------------------------*\
  PROGRESS
\*------------------------------------*/</span>
#progress{
  list-style:none; <span class="code-comment">/* Remove the bullets */</span>
  float:left; <span class="code-comment">/* Make its width equal to the combined width of the items inside it */</span>
  margin-bottom:20px;
}
#progress li{
  float:left; <span class="code-comment">/* Stack them all up left */</span>
  font-size:0.75em; <span class="code-comment">/* Make the entire item smaller */</span>
  font-style:italic; <span class="code-comment">/* Make the entire item italic */</span>
}
#progress a{
  display:block;
  text-decoration:none;
  padding:10px 25px 10px 10px; <span class="code-comment">/* Padding to accomodate background image */</span>
  background:#7b8d77;
  color:#fff;
}
#progress span{
  font-size:1.333em; <span class="code-comment">/* Bring the size of the title only back up */</span>
  font-weight:bold;
  display:block;
  font-style:normal; <span class="code-comment">/* Undo the italics */</span>
}
#progress strong{
  font-weight:normal; <span class="code-comment">/* Remove the bolding for CSS enabled browsers */</span>
}
#progress a:hover{
  text-decoration:none;
}
#progress a:hover span{
  text-decoration:underline; <span class="code-comment">/* Underline the title on hover */</span>
}
#details-page .details-step a,
#account-page .account-step a,
#products-page .products-step a,
#payment-page .payment-step a{
  background:url(../img/css/splitter.gif) right center no-repeat #a49d4d; <span class="code-comment">/* Arrow image on the current step */</span>
}
#go-page .go-step a{
  background:#a49d4d; <span class="code-comment">/* Arrow image not needed on final step, colour only */</span>
}</code></pre>
<p>All of the above is very obvious, it is essentially just like creating a normal navigational menu, and gives us this:</p>
<p><img src="http://csswizardry.com/wp-content/uploads/2010/11/progress-basic.jpg" alt="Basic progress bar" class="full" /></p>
<h2 id="section-numbers">Styling numbers in ordered lists</h2>
<p>Next up we style the numbers in the ordered list by using the very very useful and much unknown CSS counter module. Because you have such limited control over the appearance of your bullets in (ordered) lists they can be a pain to style. This pain is alleviated somewhat when using an unordered list as you can simply use a background image. It is an altogether different story when you&#8217;re using an ordered list as the bullet needs to change with each list item.</p>
<p>What we do here is use CSS to do a very prog-like job; we get it to loop through each item in a parent container and then increment a user-defined value each time it encounters a specified child. Sounds Greek? <a href="http://www.impressivewebs.com/css-counter-increment/" title="Excellent article on CSS counters">Read this</a>.</p>
<p>Once we have this number available to us we use the CSS <code>:before</code> pseudo-element and the <code>content:;</code> property to insert the number before each item. How cool is that?!</p>
<pre><code><span class="code-comment">/*------------------------------------*\
  PROGRESS
\*------------------------------------*/</span>
#progress{
  list-style:none;
  float:left;
  margin-bottom:20px;
  counter-reset:step; <span class="code-comment">/* Set up name of increment on parent */</span>
}
#progress li{
  float:left;
  font-size:0.75em;
  font-style:italic;
}
#progress a{
  display:block;
  text-decoration:none;
  padding:10px 25px 10px 30px; <span class="code-comment">/* Padding changed to 30px to accomodate number */</span>
  background:#7b8d77;
  color:#fff;
  position:relative; <span class="code-comment">/* Relative position to allow absolute positioning later on */</span>
}
#progress span{
  font-size:1.333em;
  font-weight:bold;
  display:block;
  font-style:normal;
}
#progress strong{
  font-weight:normal
}
#progress a:hover{
  text-decoration:none;
}
#progress a:hover span{
  text-decoration:underline;
}
#progress li a:before{
  counter-increment:step; <span class="code-comment">/* Increment the step on each occurance of this (pesudo) element */</span>
  content:counter(step); <span class="code-comment">/* Write out value of the increment */</span>
  text-align:center;
  font-weight:bold;
  position:absolute; <span class="code-comment">/* Position number */</span>
  top:50%;
  left:5px;
  margin-top:-8px;
}
#details-page .details-step a,
#account-page .account-step a,
#products-page .products-step a,
#payment-page .payment-step a{
  background:url(../img/css/splitter.gif) right center no-repeat #a49d4d;
}
#go-page .go-step a{
  background:#a49d4d;
}</code></pre>
<p>This then gives us this:</p>
<p><img src="http://csswizardry.com/wp-content/uploads/2010/11/no-css3-progress.jpg" alt="Non-CSS3 progress bar" class="full"  /></p>
<div class="hr">
<hr /></div>
<h2 id="section-progressive">Progressively enhancing</h2>
<p>Now for the CSS3 progressive bits:</p>
<pre><code><span class="code-comment">/*------------------------------------*\
  PROGRESS
\*------------------------------------*/</span>
#progress{
  background:#7b8d77; <span class="code-comment">/* Give the ol a background to prevent white showing through behind the items' round corners (change value to #f00 to see what I mean) */</span>
}
#progress{
  -moz-border-radius:5px;<span class="code-comment">/* Round all corners of the progress bar */</span>
  -webkit-border-radius:5px;
  border-radius:5px;
}
#progress a{
  text-shadow:1px 1px 1px rgba(0,0,0,0.25); <span class="code-comment">/* A small text-shadow */</span>
  -moz-border-radius:5px 0 0 5px; <span class="code-comment">/* Round the top- and bottom-left corners */</span>
  -webkit-border-radius:5px 0 0 5px;
  border-radius:5px 0 0 5px;
}
#details-page .details-step a,
#account-page .account-step a,
#products-page .products-step a,
#payment-page .payment-step a{
  background:url(../img/css/splitter.gif) right center no-repeat #a49d4d;
}
#progress .go-step a{
  -moz-border-radius:5px; <span class="code-comment">/* Round all corners of the final step */</span>
  -webkit-border-radius:5px;
  border-radius:5px;
}</code></pre>
<p>The full, combined CSS for the progress bar so far is:</p>
<pre><code><span class="code-comment">/*------------------------------------*\
  MAIN
\*------------------------------------*/</span>
html{
  height:101%;
}
body{
  font-family:Calibri, Arial, Verdana, sans-serif;
  background:#fff;
  color:#88979e;
  width:940px;
  padding:10px;
  margin:0 auto;
}

<span class="code-comment">/*------------------------------------*\
  PROGRESS
\*------------------------------------*/</span>
#progress{
  list-style:none;
  background:#7b8d77;
  float:left;
  margin-bottom:20px;
  counter-reset:step;
  -moz-border-radius:5px;
  -webkit-border-radius:5px;
  border-radius:5px;
}
#progress li{
  float:left;
  font-size:0.75em;
  font-style:italic;
}
#progress a{
  display:block;
  text-decoration:none;
  padding:10px 25px 10px 30px;
  background:#7b8d77;
  color:#fff;
  text-shadow:1px 1px 1px rgba(0,0,0,0.25);
  position:relative;
  -moz-border-radius:5px 0 0 5px;
  -webkit-border-radius:5px 0 0 5px;
  border-radius:5px 0 0 5px;
}
#progress span{
  font-size:1.333em;
  font-weight:bold;
  display:block;
  font-style:normal;
}
#progress strong{
  font-weight:normal
}
#progress a:hover{
  text-decoration:none;
}
#progress a:hover span{
  text-decoration:underline;
}

#progress li a:before{
  counter-increment:step;
  content:counter(step);
  text-align:center;
  font-weight:bold;
  position:absolute;
  top:50%;
  left:5px;
  margin-top:-8px;
  padding:2px 6px;
  background:rgba(0,0,0,0.25);

  -moz-border-radius:20px;
  -webkit-border-radius:20px;
  border-radius:20px;
}
#details-page .details-step a,
#account-page .account-step a,
#products-page .products-step a,
#payment-page .payment-step a{
  background:url(../img/css/splitter.gif) right center no-repeat #a49d4d;
}
#go-page .go-step a{
  background:#a49d4d;
}
#progress .go-step a{
  -moz-border-radius:5px;
  -webkit-border-radius:5px;
  border-radius:5px;
}</code></pre>
<p>Which, when coupled with the markup, gives this:</p>
<p><a href="/demos/progress-bar/" style="background:none;"><img src="http://csswizardry.com/wp-content/uploads/2010/11/progress.jpg" alt="Screenshot of the final product." class="full" /></a></p>
<div class="hr">
<hr /></div>
<h3>Recap</h3>
<p>So, let&#8217;s cover what we&#8217;ve done so far. We&#8217;ve:</p>
<ul>
<li>Coded up a semantic progress bar (using an ordered list and correct generic elements).</li>
<li>Made it accessible (addition of the strong around the content for non-CSS browsers).</li>
<li>Styled it all up.</li>
<li>Made use of <a href="http://www.venturelab.co.uk/devblog/2010/06/body-idsmaking-life-easier-for-yourself/">the body ID trick</a> to mark the current page.</li>
<li>Used CSS counters to style the numbers of an ordered list</li>
<li>Progressively enhanced it all to make it a little easier on the eyes.</li>
</ul>
<h2 id="section-mobile">Mobile optimisation</h2>
<p class="marginalia">For more information on mobile/iPhone optimised sites please see <a href="http://csswizardry.com/2010/01/iphone-css-tips-for-building-iphone-websites/" title="iPhone CSS&mdash;tips for building iPhone websites">my associated article</a>.</p>
<p>Next up we need to optimise this thing for mobile. This couldn&#8217;t be simpler. The key to optimising sites for mobile is linearise. Linearise everything.</p>
<p>In your markup, add this line to the <code>&lt;head&gt;</code> section, thus:</p>
<pre><code>&lt;head&gt;
  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
  &lt;title&gt;Progress&lt;/title&gt;
  <strong>&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;&quot; /&gt;</strong>
  &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/new-style.css&quot; /&gt;
&lt;/head&gt;</code></pre>
<p>This tells the user agent that the viewport should be the same as the device&#8217;s own screen-size, that it should be initially set to a scale of 1 (i.e. no scale), its maximum scale is set to 1, and that users can&#8217;t scale themselves.</p>
<p>Now, add the following to the very end of your CSS file:</p>
<pre><code><span class="code-comment">/*------------------------------------*\
	MOBILE
\*------------------------------------*/</span>
@media (max-width: 480px){ <span class="code-comment">/* In any browser narrower that 480px... */</span>
body{
	width:auto; <span class="code-comment">/* Give the body a fluid width... */</span>
	padding:5px; <span class="code-comment">/* And a slight padding */</span>
}
#progress{
	width:auto; <span class="code-comment">/* Give the list a fluid width */</span>
	background:none; <span class="code-comment">/* Remove the list's background... */</span>
	float:none; <span class="code-comment">/* ...and float */</span>
}
#progress li{
	float:none; <span class="code-comment">/* Remove list item float, causing them to stack */</span>
	margin-bottom:1px; <span class="code-comment">/* Space them slightly */</span>
}
#progress a{
	margin:0 10px; <span class="code-comment">/* Indent the left and right of each item by 10px */</span>
	-moz-border-radius:5px; <span class="code-comment">/* Round all corners */</span>
	-webkit-border-radius:5px;
	border-radius:5px;
}
#details-page .details-step a,
#account-page .account-step a,
#products-page .products-step a,
#payment-page .payment-step a,
#go-page .go-step a{
	background:#a49d4d; <span class="code-comment">/* Set the background of the current item */</span>
	margin:0 auto; <span class="code-comment">/* Remove the 10px indent to show that the step is current */</span>
}
}</code></pre>
<p>Now, if you want to test this and don&#8217;t have a smartphone, or haven&#8217;t got this hosted in a live environment, simply resize your browser window right down until you see the change. I tend to use the Firefox Web Developer Toolbar addon to <a href="http://csswizardry.com/wp-content/uploads/2010/11/mobile-optimised-progress.jpg">resize the window to 480&#215;800px</a>.</p>
<p>On the iPhone this now looks like:</p>
<p><img src="http://csswizardry.com/wp-content/uploads/2010/11/iphone-progress.jpg" alt="iPhone optimised progress bar" /></p>
<div class="hr">
<hr /></div>
<h2><a href="http://csswizardry.com/demos/progress-bar/">Demo</a></h2>
<p>For the full working demo head to <a href="http://csswizardry.com/demos/progress-bar/">http://csswizardry.com/demos/progress-bar/</a>. For the complete CSS (with reset) please see <a href="http://csswizardry.com/demos/progress-bar/css/style.css">http://csswizardry.com/demos/progress-bar/css/style.css</a>. Also, try using Firebug to change the <code>&lt;body&gt;</code>&#8217;s ID to <code>go-page</code>.</p>
<div class="hr">
<hr /></div>
<h2>Final words</h2>
<p>As I stated previously, this article isn&#8217;t so much about the progress bar itself. What I hope this article has shown is how something as small and trivial as a progress bar has a wealth of little nooks and crannies in which to immerse yourself. Semantics, accessibility, using <code>&lt;body&gt;</code> IDs to style current states without a <code>class=&quot;current&quot;</code>, how to use CSS counters to style the numbers in an ordered list, how to progressively enhance lean markup, and how to optimise things for mobile in a flash.</p>
<p>All of the above skills are easily and quickly transferable. It might be a progress bar today, but what could it be tomorrow? Skills like the ones covered here give you the potential to make something great, out of something very very simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2010/11/mark-up-a-semantic-accessible-progressively-enhanced-mobile-optimised-progress-bar-bonus-style-the-numbers-in-an-ordered-list/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

