<?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>Chapter 42 &#187; Best Practices</title>
	<atom:link href="http://chapter42.whitewhale.net/tag/best-practices/feed/" rel="self" type="application/rss+xml" />
	<link>http://chapter42.whitewhale.net</link>
	<description></description>
	<lastBuildDate>Thu, 30 Sep 2010 17:20:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>What&#8217;s up with your CSS?</title>
		<link>http://chapter42.whitewhale.net/2008/05/09/whats-up-with-your-css/</link>
		<comments>http://chapter42.whitewhale.net/2008/05/09/whats-up-with-your-css/#comments</comments>
		<pubDate>Fri, 09 May 2008 18:22:34 +0000</pubDate>
		<dc:creator>Donald</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://chapter42.whaleblogs.net/?p=14</guid>
		<description><![CDATA[We&#8217;ve been talking for a long time about (and more recently getting to work on) documenting some of White Whale&#8217;s best practices. It just seems like good stuff to have written down—and one day maybe share—but more importantly, as we slowly grow we&#8217;ll have a reference guide for anything from variable naming conventions to our [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been talking for a long time about (and more recently getting to work on) documenting some of White Whale&#8217;s best practices. It just seems like good stuff to have written down—and one day maybe share—but more importantly, as we slowly grow we&#8217;ll have a reference guide for anything from variable naming conventions to our preferred image replacement technique.</p>
<p>One of the things that&#8217;s been part of White Whale canon for some time is writing CSS declarations in a single-line format, with indents for parent-child relationships. <span id="more-14"></span>From a current project:</p>
<pre>
#events { float:left; width:200px; padding:20px; background:#444 url(/images/background_events.png) repeat-x center top; color:#fff; }
&nbsp;&nbsp;&nbsp;&nbsp;#events h3 { margin-bottom:0.5em; }
&nbsp;&nbsp;&nbsp;&nbsp;#events .date { font-weight:bold; }
</pre>
<p>It took a bit of time to get used to at first (the practice comes to White Whale from frequent White Whale collaborator <a href="http://dutchmoney.com">Jesse</a>) but, since then, scanning <a href="http://www.csszengarden.com/213/213.css">long bits of code written the old way</a> feels clunky.</p>
<p>I recently skimmed <a href="http://www.smashingmagazine.com/2008/05/02/improving-code-readability-with-css-styleguides/">an article</a> that briefly mentioned this coding style with the caveat that it &#8220;might produce messy results if you define more than 3 attributes for a given selector.&#8221; And we&#8217;ve had clients who objected on similar grounds. But I actually find that the opposite is true: longer lists of attributes actually hurt scannability more in the conventional style. The list of selectors is where hierarchy matters and where the cascade happens, and has orders-of-magnitude more elements than your average attributes-per-selector. Single-line declarations is may feel cluttered for those four or five attributes, but the organizational structure and lookup-speed benefits pay off where it really counts.</p>
]]></content:encoded>
			<wfw:commentRss>http://chapter42.whitewhale.net/2008/05/09/whats-up-with-your-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

