<?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; Progressive Enhancement</title>
	<atom:link href="http://csswizardry.com/tag/progressive-enhancement/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>Build-along #1, reflection and reasoning</title>
		<link>http://csswizardry.com/2011/11/build-along-1-reflection-and-reasoning/</link>
		<comments>http://csswizardry.com/2011/11/build-along-1-reflection-and-reasoning/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 16:03:54 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Build-along]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[OOCSS]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>
		<category><![CDATA[Responsive web design]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=3355</guid>
		<description><![CDATA[Here are, in no particular order, just a few thoughts about the build-along I did last night. These thoughts cover the thinking and reasoning behind the decisions I made. The build-along was a single, small PSD, but the following should apply to builds of any size. Get into the habit of doing the following on [...]]]></description>
			<content:encoded><![CDATA[<p>Here are, in no particular order, just a few thoughts about <a href="http://csswizardry.com/2011/11/css-wizardry-build-along-1/">the build-along</a> I did last night. These thoughts cover the thinking and reasoning behind the decisions I made. The build-along was a single, small PSD, but the following should apply to builds of any size. Get into the habit of doing the following on tiny sites and you&#8217;ll be well equipped to build that next Facebook meets YouTube with a dash of LinkedIn that that prospective client just emailed you about&#8230;</p>
<p>Here is <a href=http://dl.dropbox.com/u/2629908/build-along/index.html>the final build</a> and its code is on <a href=https://github.com/csswizardry/build-along-1>GitHub</a>.</p>
<p><span id="more-3355"></span></p>
<h2>HTML first</h2>
<p>I built this HTML-first. No CSS other than the UA&#8217;s <em>whatsoever</em>. No images, no styles, no JS, no classes, no containers, nothing. I started with pure text-level and content semantics. No <code>div</code>s, no <code>span</code>s, nothing that would in any way aid styling. Nail your pure, raw HTML first before even <em>thinking</em> about CSS. This ensures you&#8217;re thinking fully about the most important aspect of any site; its content.</p>
<h2>No IDs</h2>
<p>The build uses no IDs for styling. This was quite an odd shift for me to make, and I made it <a href=http://csswizardry.com/2011/09/when-using-ids-can-be-a-pain-in-the-class/>a number of weeks back</a>. The main drawback of using IDs is that they introduce a specificity wild card not unlike using <code>!important</code> (though obviously not as horrible). By not using them it means that I can&#8217;t really get tripped up by overly specific selectors as easily as I could if I <em>was</em> using IDs. I&#8217;ve not removed the chance completely, but really easily and quickly lessened it.</p>
<h2>&#8216;Ugly&#8217; classes to do lots of heavy lifting</h2>
<p>There are quite a few classes that some might deem ugly; the media and grid classes instantly spring to mind. The thing here is that <strong>classes aren&#8217;t semantic or insemantic</strong>, they&#8217;re merely sensible or insensible. If a <code>div</code> is 6 columns wide then a class of <code>.grid-6</code> is totally sensible, if it needs to change then change it. If you ever redesign you&#8217;ll be touching the markup anyway; I&#8217;m convinced the pure CSS redesign (in a commercial world) is a myth.</p>
<p>These classes also bring performance benefits, once a class gets called once it becomes free to use again; a performance freebie. If you use <code>grid-6</code> once on a page, every subsequent usage is totally free, from a performance point of view.</p>
<h2>Portable sprite icons</h2>
<p>The <code>.s</code> class is a theoretically horrible class, but as we outlined above, nothing (except micro-formats and similar) reads or even cares what you name your classes. <a href="http://jsfiddle.net/csswizardry/YdhEU/">You can name a class anything you wish and a browser has to honour it</a>, just pick wisely!</p>
<p>So, the <code>.s</code> class is one good example. Whenever you want to use an icon background image you ideally want to sprite it, but in fluid elements this isn&#8217;t possible. Enter a <i>spriting element</i>.</p>
<p>This is just an empty element that gets the sprite applied to it in its own fixed width/height box.</p>
<p>Chris Coyier uses <a href="http://css-tricks.com/13224-pseudo-spriting/">pseudo elements for this</a> which is great as it&#8217;s really clean, but the major drawback for me here is that they&#8217;re not very portable. A pseudo element is tied explicitly to an element in the CSS, so you can&#8217;t just drop the icon wherever you wish. Using an empty element means you <em>can</em> drop an icon wherever you wish. It&#8217;s six-of-one and half-a-dozen of the other; cleanliness versus portability; pick which one you&#8217;d rather have.</p>
<p>I can imagine that 75% reading this still think it&#8217;s a horrible, but we need to remember that an empty element affects <em>nothing</em>. It&#8217;s empty so it has no content, if it has no content then screen readers don&#8217;t encounter anything in it.</p>
<p>You&#8217;re probably also thinking that it&#8217;s heavily presentational, but there&#8217;s really no difference between:</p>
<pre><code>&lt;i class="s star"&gt;&lt;/i&gt;
</code></pre>
<p>And:</p>
<pre><code>&lt;img src=star.png alt=""&gt;
</code></pre>
<p>The first is just out-and-out better in that it allows you to sprite that image up!</p>
<p><ins datetime="2011-11-05T16:49:52+00:00" id="addendum:using-i-element">I was asked why an <code>i</code> and not a <code>span</code>. I&#8217;m almost ashamed of the answer but it&#8217;s purely because <code>i</code> is shorter, it&#8217;s as simple as that. I know that a <code>span</code> is probably better suited as it&#8217;s devoid of semantics but as there&#8217;s no content in the <code>i</code> nothing is affected by semantics anyway. Feel free to use whatever element you prefer though, like I said, my reasoning is kind of shameful!</ins></p>
<h2>Mobile first, lay the foundations</h2>
<p>I did this build mobile first, sort out the content, the type, the general <em>feel</em> of the site first, then used <code>min-width</code> media queries to build <strong>up</strong> the desktop version.</p>
<p>Incidentally I don&#8217;t use <a href=https://github.com/scottjehl/Respond>respond.js</a> or similar to get media queries working in IE et al, they get the mobile version. The layout of the site is not that important because <strong>a PSD is a clue, not a contract</strong>. A PSD tells you how a site should generally appear; the type, the colours, any brand treatments, that kind of stuff.</p>
<p>If you spend enough time on the mobile version that should be good enough to serve as the baseline, anything on top is a bonus for browsers that support media queries.</p>
<h2>Grid systems just make life easier</h2>
<p>In a similar vein to the above, grid systems are typically frowned upon as being insemantic, but the joy is that, as we covered, classes are neither semantic or in semantic. Plus&mdash;even better than that&mdash;a <code>div</code> is devoid of any semantics, it&#8217;s a generic container element. Adding these to your markup comes free-of-charge. Using a grid system allows developers to quickly construct consistent, robust and efficient layouts in seconds. </p>
<h2>&#8216;Extraneous&#8217; divs actually make builds far more robust and extensible</h2>
<p>You should <em>never</em> add markup where avoidable, but that doesn&#8217;t mean you should avoid it at all costs. Sometimes adding an extra <code>div</code> will make components a lot less brittle, rather than relying on unpredictable style rules and overly slim markup, sometimes it&#8217;s just far better to add another <code>div</code> to ensure a more robust build.</p>
<p>Take for example <a href="http://www.stubbornella.org/content/2010/06/25/the-media-object-saves-hundreds-of-lines-of-code/">the media object</a>. You could probably build that construct using far less HTML, but then would it be as extensible? You could just assume there will only ever be an <code>img</code> floated left with a <code>p</code> to the right of it, but if you do that and a client asks for a list with that <code>p</code> and a caption under the <code>img</code> you&#8217;re in a bit of a pickle; if you just start out with a <code>div</code> on each side to start with then you have the ability to build whatever the client throws at you, and it will always be predictable.</p>
<p>So, add extra markup where it saves you headaches. I&#8217;m more impressed by powerful and extensible code than I am with lean and brittle solutions, and I can guarantee which the client will prefer&#8230;</p>
<h2>Don&#8217;t measure stuff</h2>
<p>Throughout this build I only measured one thing; the grid system. I honestly think that, in web design, the pixel&#8217;s days are numbered. Build everything without a care as to its dimensions. Everything in the build can be moved around and dropped anywhere else without you needing to worry if it&#8217;ll fit. All your components should always be fully fluid and only constrained by their parent, in this case the grid system.</p>
<p>Here&#8217;s a challenge, next time your designer sends you a PSD designed on, say, the <a href="http://960.gs">960GS</a>, resize your browser to 800px wide and build it like that. That&#8217;ll really put your fluid, responsive skills to the test!</p>
<h2>Be resourceful</h2>
<p>During this build I copied and pasted <em>loads</em> of code. I used <a href="https://github.com/csswizardry/vanilla">my vanilla boilerplate</a>, I copied and pasted <a href="http://www.stubbornella.org/content/2010/06/25/the-media-object-saves-hundreds-of-lines-of-code/">the media object</a>, <a href="csswizardry.com/2011/09/the-nav-abstraction/">the nav abstraction</a>, <a href="csswizardry.com/2011/10/fully-fluid-responsive-css-carousel/">the carousel</a>. If it already exists somewhere then reuse it! There are no prizes for writing more lines of code; be resourceful.</p>
<h2>Take away?</h2>
<p>Even on tiny sites, powerful markup is far more quick, robust, extensible and sensible than convoluted, brittle stuff. No one reads your classes except other developers. Users appreciate fast UIs, clients appreciate stable and robust sites and you, the developer, like to save time, be efficient and only solve problems once.</p>
<p>What may at first seem like an ugly class or bloated markup is actually a really quick, predictable and reusable construct.</p>
<p>Websites make us money, so let&#8217;s make them as quickly as possible and in the most predictable, future proof way we can.</p>
<h2>Finally</h2>
<p>There is a video of the build to go with this, but I need your opinions, do you want the full, several hour epic or do you want it sped up to, say, double speed? I&#8217;m going to get that processed as soon as possible.</p>
<h2><ins datetime="2011-11-07T11:12:59+00:00" id="addendum:video">Update</ins></h2>
<p>As promised, I recorded the whole thing warts and all. You might be interested to know a few things non-code related about the build-along.</p>
<ul>
<li>The whole lot was done on an 11&Prime; MacBook Air with no external mouse or keyboard.</li>
<li>My good friend Jake, who is wanting to learn a little about web development, was next to me the whole time.</li>
<li>I cooked and ate my (now famous (in tiny, tiny circles)) chili during the build-along.</li>
<li>Refreshment was courtesy of <a href="http://twitpic.com/78e9yd">Matusalem and Fentimans</a>.</li>
<li>The songs you saw on my Spotify are not necessarily wholly representative of my taste in music ;)</li>
</ul>
<p>The normal, non-sped-up recording is now on YouTube. <a href="http://www.youtube.com/watch?v=dH-KgnepMUw&#038;hd=1">Part 1</a>, <a href="http://www.youtube.com/watch?v=9NToqlCJzfQ&#038;hd=1">Part 2</a>. The sped-up version is proving a little more troublesome; crunching over 4 hours of video on an 11&Prime; Air is taking a while&#8230;</p>
<h3><ins datetime="2011-11-07T13:19:59+00:00" id="addendum:fast-video">Sped-up video</ins></h3>
<p>To view the faster video right away, simply opt in to <a href="http://www.youtube.com/html5">YouTube&#8217;s HTML5 Trial</a>, open the YouTube URLs above in Chrome and then select the playback speed options that now appear on the player.</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2011/11/build-along-1-reflection-and-reasoning/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Sam Penrose Design&#8212;process and write-up</title>
		<link>http://csswizardry.com/2011/11/sam-penrose-design-process-and-write-up/</link>
		<comments>http://csswizardry.com/2011/11/sam-penrose-design-process-and-write-up/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 22:22:08 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Content-out]]></category>
		<category><![CDATA[Mobile first]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>
		<category><![CDATA[Responsive web design]]></category>
		<category><![CDATA[sampenrose.co.uk]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=3318</guid>
		<description><![CDATA[Last weekend, one of my best friends Sam and I had a hack-weekend. One weekend of non-stop design and build. It was a pretty brutal affair considering we were only making a tiny portfolio site; a weekend of 4am nights, junk food, beer and dangerous amounts of Red Bull.
I&#8217;ve just about recovered now, and here [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend, one of my best friends <a href="http://twitter.com/sam_penrose">Sam</a> and I had a hack-weekend. One weekend of non-stop design and build. It was a pretty brutal affair considering we were only making a tiny portfolio site; a weekend of 4am nights, junk food, beer and dangerous amounts of Red Bull.</p>
<p>I&#8217;ve just about recovered now, and here is the result: <a href="http://sampenrose.co.uk/">Sam Penrose Design&mdash;Creative designer and graffiti artist based in Leeds, UK</a></p>
<p><span id="more-3318"></span></p>
<p><a href="http://sampenrose.co.uk"><img src="http://csswizardry.com/wp-content/uploads/2011/11/sampenrose.co_.uk_.jpg" alt="Screenshot of the Sam Penrose Design website"></a></p>
<p>This was a really cool build for me, Sam was a great &#8216;client&#8217; in that he instantly &#8216;got&#8217; progressive enhancement, he was totally cool with the fact that differences between browsers may be quite obvious (and glaring). He was fine with his idea of a design ending up being more like three designs, when different browsers are accounted for.</p>
<p>Buzzword time! This build was:</p>
<ul>
<li><em>Heavily</em> progressively enhanced</li>
<li>Content-out</li>
<li>Mobile first</li>
<li>Responsive</li>
<li>Designed in browser</li>
</ul>
<p>I&#8217;ll touch on each of these in a little more detail.</p>
<h2>Progressive enhancement</h2>
<p>Basic really; this site uses loads of gradients, round corners, shadows, all that stuff. None of it works in IE<i>x</i> but that&#8217;s cool. Sites don&#8217;t have to look the same in every browser (and we took that to a bit of an extreme where media queries are concerned).</p>
<p>It uses my <a href="csswizardry.com/2011/10/fully-fluid-responsive-css-carousel/">fluid carousel</a> which doesn&#8217;t even behave like a carousel in IE, it acts as more of a promo. This is fine, though, as we were careful to only put non-essential content in here. Got a good browser? You get a pure CSS carousel. Got an older one? You get what looks like a nice, fluid promo panel.</p>
<p>In case you&#8217;re interested here is a screenshot of IE8:</p>
<p><a href="http://csswizardry.com/wp-content/uploads/2011/11/untitled.JPG"><img src="http://csswizardry.com/wp-content/uploads/2011/11/untitled.JPG" alt="Sam Penrose Design in IE8"></a></p>
<h2>Content-out</h2>
<p>We started off with just the content; I built pure markup to start, with no CSS whatsoever. We got the content into the page and then Sam decided how he&#8217;d like to design around that. It worked a treat and kept everything really really clean.</p>
<h2>Mobile first</h2>
<p>With the content in place, we looked to build the site mobile first. This was really simple, but we spent most of the time on it. We simply created a fluid, single column design. We spent ages working on the mobile, most stripped back version to ensure that it was a perfect base. We wanted to make sure that anything on top of the mobile version would be taking the site <a href="http://www.youtube.com/watch?v=EbVKWCpNFhY">up to 11</a>.</p>
<p>Investing so much time on the mobile version was really fun and really sensible, it made the next bit a breeze.</p>
<h2>Responsive</h2>
<p>Naturally, the site is responsive. The interesting thing is, though, that we&#8217;ve not bothered getting media queries to work in IE. The beauty of having spent so much time on the mobile version is that it&#8217;s not just an <em>okay</em> state to serve IE, it&#8217;s actually a really nice one! The site is all fluid and built with <code>min-width</code> media queries to size the site up from mobile as opposed to down from desktop.</p>
<h2>Designed in the browser</h2>
<p>Other than to process some portfolio images and create the dotted background image, Photoshop wasn&#8217;t used once. We built the whole site in the browser. The interesting thing about our process though was that Sam doesn&#8217;t code, but nor was he Photoshopping.</p>
<p>As he was learning the theory of exciting techniques in 2011 web design, he was applying them just as fast in order to art direct the design and build. He switched on to the idea of progressive enhancement and mobile first instantly so he didn&#8217;t struggle to adapt to a new way of thinking. He called the shots, saw how designing in the browser allowed us to test, iterate, drop and ultimately refine and create his ideas. Such a lean and neat process. He didn&#8217;t get precious about things, he didn&#8217;t beat a dead horse, he suggested, we tried, we reworked, we settled on the most pragmatic options.</p>
<p>So yeah, quite a fun and productive hack-weekend, if a little tiring.</p>
<p>Sam, by the way, is a newly freelance designer, so if you need any stuff doing you know where to find him. He&#8217;s also on Twitter at <a href="http://twitter.com/sam_penrose">@sam_penrose</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2011/11/sam-penrose-design-process-and-write-up/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<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>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>Simplified page borders in pure CSS</title>
		<link>http://csswizardry.com/2010/12/simplified-page-borders-in-pure-css/</link>
		<comments>http://csswizardry.com/2010/12/simplified-page-borders-in-pure-css/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 16:26:40 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=1926</guid>
		<description><![CDATA[You may well be familiar with John Hicks&#8217; page borders that he uses on his site. These are a series of fixed position &#60;b&#62; elements that are placed top, right, bottom and left of the viewport over the content, giving the illusion of a fixed border. I wanted to achieve a similar effect recently but, [...]]]></description>
			<content:encoded><![CDATA[<p><span class="opener"><span>Y</span>ou</span> may well be familiar with <a href="http://hicksdesign.co.uk/">John Hicks</a>&rsquo; page borders that he uses on his site. These are a series of fixed position <code>&lt;b&gt;</code> elements that are placed top, right, bottom and left of the viewport over the content, giving the illusion of a fixed border. I wanted to achieve a similar effect recently but, given <a href="http://csswizardry.com/2010/12/the-implementation-appreciation-rule/">my militant approach to progressive enhancement</a>, I decided to drop the insemantic markup and fashion a pure CSS alternative. For a live demo please visit <a href="http://suzannahaworth.com/">suzannahaworth.com</a>.</p>
<pre><code><span class="code-comment">/*------------------------------------*\
	BORDERS
\*------------------------------------*/</span>

<span class="code-comment">/* Create a series of empty pseudo-elements... */</span>
html:before,html:after,body:before,body:after{
	content:"";
	background:#dad8bb;
	position:fixed;
	display:block;
	z-index:5;
}

<span class="code-comment">/* ...and position them! */</span>
html:before{
	height:10px;
	left:0;
	right:0;
	top:0;
}
html:after{
	width:10px;
	top:0;
	right:0;
	bottom:0;
}
body:before{
	height:10px;
	right:0;
	bottom:0;
	left:0;
}
body:after{
	width:10px;
	top:0;
	bottom:0;
	left:0;
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2010/12/simplified-page-borders-in-pure-css/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>The implementation &#8733; appreciation rule</title>
		<link>http://csswizardry.com/2010/12/the-implementation-appreciation-rule/</link>
		<comments>http://csswizardry.com/2010/12/the-implementation-appreciation-rule/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 17:02:28 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Clients]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=1902</guid>
		<description><![CDATA[I&#8217;ve mentioned this idea to a few designers and developers of late who all seem to agree that it has a point and makes sense, so I thought I&#8217;d write up my thoughts on what I call the implementation &#8733; appreciation rule. That is to say, anything you spend time building (on top of, as [...]]]></description>
			<content:encoded><![CDATA[<p><span class="opener"><span>I</span>&rsquo;ve</span> mentioned this idea to a few designers and developers of late who all seem to agree that it has a point and makes sense, so I thought I&#8217;d write up my thoughts on what I call <i>the implementation <span title="Proportional to">&prop;</span> appreciation rule</i>. That is to say, anything you spend time building (on top of, as well as and beyond the scope of the base build) should reap an amount of appreciation from the users that is proportional to the time it took to implement.</p>
<p class="marginalia">I have a very aggressive and die-hard approach to progressive enhancement which I guess is to thank, in part, for the rule itself.</p>
<p>Let&#8217;s start with a very basic and tongue-in-cheek example. Let&#8217;s imagine your client comes to you and says <q>&#8216;Hi, yeah, I love the site but can we make all the links, headings and image borders the same colour as my chihuahua&#8217;s eyes?&#8217;</q> &#8230; <q>&#8216;Well sure, you can, but it&#8217;ll take an hour at £xxx and I don&#8217;t think that it&#8217;s going to bring enough user attention, or even be noticed enough&mdash;if at all&mdash;to warrant the time it&#8217;ll take me to do and the money it&#8217;ll cost you to have it done.&#8217;</q> In other words, the implementation is not proportional to the appreciation.</p>
<p>Now this is a very stereotypical and clichéd client-from-hell example, but it does paint a picture of how the rule works; will the time it takes you to change something, or add a feature, reap enough benefits to make it worthwhile?</p>
<p>You can&#8217;t really feed this equation any numbers, of course, but that&#8217;s where it&#8217;s up to you to decide what is the cut off point. If you think that the amount of time it will take you to add a feature <em>is</em> worthwhile and <em>will</em> have a proportional appreciation then that&#8217;s your choice, and whilst it may not be the same outcome as the agency down the road, it&#8217;s you who is building that website.</p>
<p>A more realistic example was during a build I was on with at work. I saw something in a PSD that I thought was missable enough not to fulfil the implementation <span title="Proportional to">&prop;</span> appreciation rule; the time it would have taken me to code a robust, &lt;IE7 solution would have been far greater than the amount of time any user would have spent thinking &#8216;Wow, I&#8217;m glad he did that!&#8217;</p>
<p>I had no metrics here, I wasn&#8217;t able to say &#8216;this will take me 45 minutes to get working in IE7 and below and will only be appreciated 0&ndash;0.8 seconds by any given user&#8217;, but sometimes you just know what is sensible and what isn&#8217;t.</p>
<p>I guess that&#8217;s part of the beauty of the implementation <span title="Proportional to">&prop;</span> appreciation rule; you decide its metrics and make them work for you.</p>
<p>I guess also, given the right account or project manager, a &#8216;more quantifiable&#8217; or rational, measurable and reasonable stance such as the implementation <span title="Proportional to">&prop;</span> appreciation rule could well be a more diplomatic and sensible way to steer clients toward taking the progressive enhancement route; something which nigh on all developers would love!</p>
<p>I think an approach such as this is best introduced either on your own personal projects, or on builds where your clients is okay with progressive enhancement (which, hopefully, they all are!). After that I guess it would be time to introduce your most stubborn clients to it. After all; more often than not you&#8217;re building sites for your clients&#8217; clients. Just because your client thinks dog-eye-blue links look cool does not mean to say <em>their</em> clients and users will, and <em>they&#8217;re</em> the ones that matter…</p>
<p>Furthermore, money talks. Being able to say &#8216;this will cost you £xxx and is almost certainly not going to make you a single penny&#8217; (politely, of course) can often be enough to steer even the most headstrong client.</p>
<p>And of course, even if something does not fulfil the rule and your client is <em>still</em> insistent on a piece of work being done; they&#8217;re paying you! Even if it makes no sense to you, or in the eyes of the equation, just see it as extra cash!</p>
<p>So I don&#8217;t suppose I&#8217;ve said anything new here, rather I&#8217;ve just offered a semi-quantifiable way to justify a more progressive approach to working for and with your clients. If a user won&#8217;t appreciate or even notice it then why bother wasting time and money on it?</p>
<p><strong>The implementation must be proportional to the appreciation.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2010/12/the-implementation-appreciation-rule/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>
		<item>
		<title>Designing in the browser leads to better quality builds</title>
		<link>http://csswizardry.com/2010/10/designing-in-the-browser-leads-to-better-quality-builds/</link>
		<comments>http://csswizardry.com/2010/10/designing-in-the-browser-leads-to-better-quality-builds/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 17:03:51 +0000</pubDate>
		<dc:creator>Harry Roberts</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Progressive Enhancement]]></category>

		<guid isPermaLink="false">http://csswizardry.com/?p=1462</guid>
		<description><![CDATA[Last night I got to thinking that the majority of design and build I have done in the past few years I have done straight into the browser. Personal sites, personal clients and some clients worked on during employment&#8212;all have benefited from being designed in the browser, and their code has benefited also. I maintain [...]]]></description>
			<content:encoded><![CDATA[<p><span class="opener"><span>L</span>ast</span> night I got to thinking that the majority of design and build I have done in the past few years I have done straight into the browser. Personal sites, personal clients and some clients worked on during employment&mdash;all have benefited from being designed in the browser, and their code has benefited also. I maintain that the build quality of a site designed in the browser can be far greater than if it started its life in Photoshop.</p>
<p><span id="more-1462"></span></p>
<h2>A little background</h2>
<p class="marginalia"><strong>N.B.</strong> I am in no way saying we invented the concept of designing in the browser, we merely adopted it <em>very</em> early, before most.</p>
<p>I have championed designing in the browser long before it became popular. True fact. I was doing this long before it was a mainstream practice.</p>
<p>When working at <a href="http://sense.co.uk/">Sense</a> I was extremely lucky to work alongside a man called <a href="http://twitter.com/ReluctantPhil">Philip Meitiner</a>. He was Sense&#8217;s Account Director and a genuine pleasure to work with and learn from. It was whilst we were working on a white-label website for some big name clients (Nissan, Renault, Mercedes, Volvo and more&#8230;) that we decided to ditch Photoshop and dive straight into the browser. This idea was born from the fact that I&#8217;d put together a series of HTML wireframes whose code was of a quality that I deemed suitable for production. It seemed backward to us to then fire up Photoshop and design an image based on a set of HTML pages, to then return to the HTML and style it.</p>
<p>Thus was born our idea to design in the browser. We saved the HTML in isolation and used it as a starting point for each development of the various sites we had to build. We branded and designed each white-label in the browser and sent live, actual code back to the client for approval. It was, for everyone involved (though me more so) a dream come true.</p>
<h3>The article I wish I&#8217;d written</h3>
<p>Months later, 24 Ways published <a href="http://24ways.org/2009/make-your-mockup-in-markup">their article on designing in the browser</a>. If there was one article I wish I&#8217;d written, it&#8217;s that one. Phil was equally dismayed, however at least we knew we were on to something good.</p>
<h2>How it works</h2>
<p>For those not in the know, designing in the browser is exactly as it sounds. Instead of building a website in Photoshop then markup, you dive straight into the browser and notepad and get cracking. A few benefits:</p>
<ul>
<li>Saves time, cutting all Photoshop work.</li>
<li>Changing repeated elements (e.g. hyperlink colours) takes just one CSS declaration in the browser. It takes a lot of donkey work in Photoshop.</li>
<li>Clients buy websites, not printouts of websites. Designing in the browser allows them to see how their site looks in its intended environment.</li>
<li>This makes progressive enhancement usage much simpler. If they view it in Chrome, they see your round corners. If they view it in IE they see square corners. Both are intended behaviours, and both are fine.</li>
<li>It can show things like hover effects and interactions that Photoshop can&#8217;t.</li>
</ul>
<blockquote><p>&#8220;Clients buy websites, not printouts of websites.&#8221;</p>
</blockquote>
<h2>How it improves build quality</h2>
<p>There are a few reasons why I believe that designing in the browser improves the overall build quality of a website.</p>
<p>Users don&#8217;t (generally) visit a website for its design, they visit for its content. Designing in the browser considers content first. This is absolutely essential for a well thought out website, in my opinion. In Photoshop you design a layout and then populate it with content. Designing in the browser you start with your content and design around it. Content is the focus and the design does nothing but complement it. You&#8217;re coming up with a suitable way to house the content you&#8217;re starting out with, rather than shoehorning content into a preconceived design.</p>
<p>By focussing on what your users are actually coming for, you often find that a better UX will follow. Ignore anything extraneous to begin with, nail the fundamentals (hint: <a href="http://www.informationarchitects.jp/en/the-web-is-all-about-typography-period/">typography</a>!) and concentrate on how pretty it looks after. Designs change more frequently than content does; invest in the content early.</p>
<blockquote><p>&#8220;What happens when your Photoshop printout uses nice anti-aliased Helvetica, and the final site renders in non-aliased Arial on the client&#8217;s machine?&#8221;</p>
</blockquote>
<p>Another reason is that, particularly if you are in a team where the designers don&#8217;t do a lot of hands-on coding and build, devoting a lot of code to purely visual effects and design can lead to insensible builds, insemantic markup and a whole host of other issues. This is, admittedly, a marginal chance, but coding around the content before the design will often lead to more sensibly built websites, focussing more effectively on its content.</p>
<p>The main time to use the designing in the browser as your primary build method is probably with a lot more sites than you&#8217;d imagine. Blogs, ecommerce, portfolios, news sites, apps, aggregators. You name it.</p>
<h2>Designer to developer</h2>
<p class="marginalia">Hopefully this one doesn&#8217;t happen often, but it can do&#8230;</p>
<p>I&#8217;m sure developers have had this countless times&#8211;a designer brings you a design that just isn&#8217;t codable. The client had been shown a PSD that you have no hope of coding unless you botch and hack at markup and use ridiculously extraneous amounts of Javascript to manipulate it. By designing at code level you avoid all these problems from the outset. What you code <em>is</em> your design, your design <em>is</em> codable.</p>
<h3>Designers obsolete?</h3>
<p>Far from it. The designer is often the developer anyway, and if not, the designer is needed to call the creative shots and create initial visuals. Take <a href="http://venturelab.co.uk/">Venturelab</a> for example. <a href="http://twitter.com/simonwiffen">Si</a> came up with the skeleton of that design in Photoshop. Any type work, any calls-to-action, lists, navigation and tables were done by me, in the browser. Si created two &#8216;mood board&#8217; style PSDs (and very good ones at that) but <a href="http://twitter.com/JustinWhitston">Justin</a> was only ever shown working code, designed in the browser.</p>
<p>Nail the backbone in Photoshop if needs be, but in areas where rapid development and the need for quick and arbitrary changes are needed (think typography and link colours etc.) designing in the browser is far more efficient. Imagine the pain of changing the zebra-stripe colours of a giant table in Photoshop when you just edit one CSS declaration and see to it all in one go.</p>
<h2>On pushing the limits</h2>
<p>There have however been one or two occasions in my career where not designing in the browser has done more good for a project than bad.</p>
<blockquote><p>&#8220;There&#8217;s a large chance that [a developer working in the browser] won&#8217;t make things difficult for themselves, that they won&#8217;t push their boundaries. This is a bad thing.&#8221;</p>
</blockquote>
<p>The first example links back to what I said about designers handing sites to developers that the developers can&#8217;t code. If the person designing the site is also the person building it, there is a (pretty large) chance that they&#8217;ll take the <del datetime="2010-10-05T10:35:57+00:00">easiest</del> <ins datetime="2010-10-05T10:35:57+00:00">simplest</ins> route to completion. There&#8217;s a large chance that they won&#8217;t make things difficult for themselves, that they won&#8217;t push their boundaries. This is a bad thing.</p>
<p>If I draw on my own experience, the <a href="http://www.finduscrispypancakes.com/">Findus Crispy Pancakes</a> site is an excellent example of designers giving developers the kind of headaches we love. I built Findus about a year or so ago whilst at Sense. <a href="http://twitter.com/RobFarnell">Rob</a> designed the site in Photoshop and when I saw it I nearly fainted. I had no idea where I&#8217;d even start coding up such a complex looking, overlapping, quite frankly mental design.</p>
<p>Yet despite this, I got my developers brain on and got to work. I finished the site about four days ahead of schedule and enjoyed every minute of it. That design pushed me more than it would have if it had started out in the browser. It was a lot better for being in Rob&#8217;s hands first. And I still maintain that it was one of my most challenging builds to date (IE6 support&#8230;).</p>
<h3>Developers still need designers!</h3>
<p class="marginalia"><a href="http://twitter.com/RobFarnell">Follow Rob on Twitter</a>. Fantastic designer and all-round nice guy.</p>
<p>It is important that the designer and developer have overlapping knowledge of each others&#8217; respective areas, yet play to their fullest in their own. The Findus site was a bit of fun on a small project which allowed me and Rob to really stretch ourselves, and that&#8217;s what it&#8217;s all about.</p>
<h3>Big brands</h3>
<p>Another couple of times where designing in the browser hasn&#8217;t been viable was when we, at Sense, were working on the <a href="http://travelodge.co.uk/">Travelodge</a> and <a href="http://rizla.co.uk/">Rizla</a> websites. Travelodge was designed by another agency anyway, but even so, as they had very stringent brand guidelines that stated that round corners were a pivotal part of the brand, everything needed to be done in Photoshop.</p>
<p>Another example would be Rizla, which, again, we built at Sense. As Rizla&#8217;s brand is so important to their success and recognition it could not have just gone straight into the browser. Rizla wasn&#8217;t so much about quickly accessible content, so much as heavily designed and branded content. We allowed for users to change the design, and for the design to carry off promotional work, which could not have happened straight in the browser.</p>
<h2>Aiding programmers</h2>
<p class="marginalia">This section was edited in part by <a href="http://twitter.com/dan_bentley">Dan Bentley</a>.</p>
<p>Programmers manipulate markup. A Photoshop document is nigh on totally useless to a programmer, whose involvement lies in all that magic stuff that happens behind the scenes. Allowing programmers access to the code from an earlier point means they can start their job alongside the developer sooner.</p>
<p>Furthermore is the idea that Javascript developers can visualise their involvement much sooner, too, and see what markup they will be manipulating from the outset, rather than having to second guess what markup might result from the developer&#8217;s take on the PSD. They can start manipulating the DOM and begin building prototypes alongside the main build developer right from the start, making life easier for them as well.</p>
<h2>When do you design in the browser?</h2>
<p>At every available opportunity.</p>
<p>It saves time, it&#8217;s a much better way of presenting concepts to clients, it leads to better quality builds, it gives more consideration to content, it&#8217;s more fun than working in Photoshop (at least from my point of view), it&#8217;s easier to experiment, it&#8217;s far more efficient and the quality of the code is usually better as it concerns itself with content over decoration.</p>
<blockquote><p>&#8220;Designs change more frequently than content does; invest in the content early.&#8221;</p>
</blockquote>
<p>For any content-centric sites (I know, <em>all</em> sites are about content) such as blogs, web-apps, CMS style dashboard builds, news sites, informational sites or anything similar, you can&#8217;t lose by designing in the browser.</p>
<p>If you&#8217;re an account manager type person at an agency, run the idea past your development team; I&#8217;m pretty sure they&#8217;d love to work like this, if they don&#8217;t already.</p>
<h3>When can&#8217;t it be used?</h3>
<p>Sometimes, designing straight in the browser just can&#8217;t work. Heavily branded or very graphical sites that are more about decoration or branding than content will be a struggle to create without opening Photoshop first. However, by completing the major chunk of the layout and graphical design in Photoshop, you can often leave it at that, and model/work on type straight in the browser (what happens when your Photoshop printout uses nice anti-aliased Helvetica, and the final site renders in non-aliased Arial on the client&#8217;s machine?). For the fine details, designing in the browser will be far more efficient and true-to-life than using Photoshop will ever be. Embrace it, and enjoy it.</p>
<h2>Final word</h2>
<p>So, do you design in the browser? Are there any reasons why you don&#8217;t? Would you like to? Leave a comment and open the debate up a little wider&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://csswizardry.com/2010/10/designing-in-the-browser-leads-to-better-quality-builds/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
	</channel>
</rss>

