<?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; CSS</title>
	<atom:link href="http://chapter42.whitewhale.net/tag/css/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>Tables and CSS columns, Part II: Making the best of a bad situation</title>
		<link>http://chapter42.whitewhale.net/2008/06/19/tables-and-css-columns-part-ii-making-the-best-of-a-situation/</link>
		<comments>http://chapter42.whitewhale.net/2008/06/19/tables-and-css-columns-part-ii-making-the-best-of-a-situation/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 00:27:44 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[free stuff]]></category>
		<category><![CDATA[tables]]></category>
		<category><![CDATA[whitewhale]]></category>

		<guid isPermaLink="false">http://chapter42.whaleblogs.net/?p=53</guid>
		<description><![CDATA[So having said all that, the way we&#8217;re handling CSS columns these days is actually pretty cool.  Here&#8217;s some sample CSS, from a site in development with a 720px wide content area:
/* Column layouts */
.column { float:left; overflow:hidden;}
.columns { margin-bottom:20px; padding-top:10px; }
.three.columns .first { width:200px; padding-right:20px; }
.three.columns .second { width:200px; padding:0 20px; }
.three.columns .third { [...]]]></description>
			<content:encoded><![CDATA[<p>So <a href="http://chapter42.whaleblogs.net/?p=52">having said all that</a>, the way we&#8217;re handling CSS columns these days is actually pretty cool.  Here&#8217;s some sample CSS, from a site in development with a 720px wide content area:</p>
<pre>/* Column layouts */
.column { float:left; overflow:hidden;}
.columns { margin-bottom:20px; padding-top:10px; }
.three.columns .first { width:200px; padding-right:20px; }
.three.columns .second { width:200px; padding:0 20px; }
.three.columns .third { width:200px; padding-left:20px; }
.two.columns .first { width:300px; padding-right:20px; }
.two.columns .second { width:300px; padding-left:20px; }</pre>
<pre><span style="font-family: 'Lucida Grande'; line-height: 19px; white-space: normal;">This lets us code the XHTML like this:</span></pre>
<pre>&lt;div class="three columns"&gt;
     &lt;div class="first column"&gt;
         Column 1
     &lt;/div&gt;
     &lt;div class="second column"&gt;
         Column 2
     &lt;/div&gt;
     &lt;div class="third column"&gt;
         Column 3
     &lt;/div&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;
&lt;/div&gt;  </pre>
<p>&#8230; which is pretty nice semantically.</p>
]]></content:encoded>
			<wfw:commentRss>http://chapter42.whitewhale.net/2008/06/19/tables-and-css-columns-part-ii-making-the-best-of-a-situation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tables and CSS columns, Part I: How an HTML table is like a cigarette</title>
		<link>http://chapter42.whitewhale.net/2008/06/19/tables-and-css-columns-part-i/</link>
		<comments>http://chapter42.whitewhale.net/2008/06/19/tables-and-css-columns-part-i/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 23:31:00 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bad habits]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[guilty pleasures]]></category>
		<category><![CDATA[tables]]></category>
		<category><![CDATA[whitewhale]]></category>

		<guid isPermaLink="false">http://chapter42.whaleblogs.net/?p=52</guid>
		<description><![CDATA[You don&#8217;t use HTML tables for layout.  Every standards-based Web designer knows this.  
As of June 2008, this notion is so deeply buried in the conventional wisdom about Web page design that just about nobody ever thinks about it anymore; the idea of using a table for anything other than Tabular Data is met with [...]]]></description>
			<content:encoded><![CDATA[<p>You don&#8217;t use HTML tables for layout.  Every standards-based Web designer knows this.  </p>
<p>As of June 2008, this notion is so deeply buried in the conventional wisdom about Web page design that just about nobody ever thinks about it anymore; the idea of using a table for anything other than Tabular Data is met with scorn and derision from developers.  And so the lowly &lt;table&gt; tag sits alone in the lunchroom, friendless, with nobody to talk to except its perpetual hangers-on &lt;td&gt; and &lt;tr&gt;.</p>
<p>Now of course, we don&#8217;t use tables for layout at White Whale.  Ever.  How could we?  It&#8217;d be like driving an SUV, listening to a Zune, or voting Republican—<em> it&#8217;s something cool people just don&#8217;t do.</em>  We (as a company) couldn&#8217;t design a site with layout tables and look at ourselves in the morning.</p>
<p>But I don&#8217;t like conventional wisdom, and as a result I often find myself thinking about tables— in particular, how there are some things you can do with &lt;table&gt; that you can&#8217;t do with &lt;div&gt;, no matter how hard you try.  (At least across all browsers, and without using Javascript.)  <span id="more-52"></span></p>
<p>What makes it worse is that these are some REALLY, REALLY SIMPLE THINGS.  Like attaching a footer to the bottom of the viewport, or the bottom of the content area, whichever is appropriate.  Like displaying two columns of content, and having the width of the two columns be determined by whatever makes sense for the amount of content they contain.  Like setting a content area at, say, 10% width, unless your content contains a word like &#8220;supercalifragilisticexpialidocious,&#8221; in which case the content area won&#8217;t get any narrower. </p>
<p>Now, I know not many people read this blog, but if this were a serious CSS design blog (which we modestly hope it someday may be), I&#8217;m sure we&#8217;d get commenters tossing out &lt;div&gt;-based solutions for all these cases.  I am pretty good at CSS, but I&#8217;m certainly not a black belt, and it wouldn&#8217;t surprise me at all if there are some decent solutions out there.  But here&#8217;s the thing—<em>all this stuff is built into</em> &lt;table&gt;.  And all browsers get it.  Automatically.</p>
<p>&lt;table&gt; is a relic from a simpler time, when there was a general idea that common sense ought to govern how browsers render Web pages.  &lt;div&gt; is a creature of the present— all it knows is rules.  It knows nothing of &#8220;common sense.&#8221;  As a result, much of CSS design— even <a href="http://www.alistapart.com/articles/holygrail" target="_blank">the high end stuff</a>— becomes an attempt to duplicate in CSS behavior that comes naturally to a &lt;table&gt;.</p>
<p><a href="http://oikl.org/" target="_blank">Here&#8217;s a quick site I did last summer for a kickball league we started in Oakland.</a>  If you resize it a bit, making the page really small, really big, etc., you&#8217;ll see how there&#8217;s a 250px wide side column, a title at the top that changes color as it crosses the color line, and background images pegged to page bottom.  I must have spent four hours getting that to work in CSS, without success; once I decided to use a table, I coded it in five minutes.  </p>
<p>But of course, that&#8217;s a personal site; we could never have done that for a client site. Now, those of you who know us know that Donald is the most standards-obsessed Whale; he handles all our initial CSS buildouts once designs are approved.  We often have conversations like this:</p>
<blockquote><p><em>Jason:</em>  Why isn&#8217;t the buildout done yet?</p>
<p><em>Donald:</em>  Grrr!  I&#8217;m having a hard time getting (insert awesome design feature here) to work in IE6.</p>
<p><em>Jason: </em> Well, you know, you could use a table for that.</p>
<p><em>Donald:  </em>No I can&#8217;t.</p>
<p><em>Jason (knowing D hates when I ask this):  </em>Why?</p>
<p><em>Donald:</em>  Because tables aren&#8217;t accessible.</p>
<p><em>Jason:</em>  Are you suggesting that an audio browser isn&#8217;t able to interpret a one-row table?  Do you suppose, then, that <a href="http://www.google.com/" target="_blank">this page</a>, which uses a table for layout, is inaccessible?</p>
<p><em>Donald:</em>  It&#8217;s just not best practices.</p>
<p><em>Jason:  </em>Well, if it can be rendered by a screen reader, and it works across all modern browsers, and actually involves less code than a CSS solution, how is that not best practices?</p>
<p><em>Donald:</em>  People will laugh at us.</p>
<p><em>Jason:  </em>OK, fine.  But if we don&#8217;t get it solved by tomorrow afternoon, I&#8217;ll use tables and code it myself.</p></blockquote>
<p>And then Donald stays up all night and figures it out.</p>
<p>The fact is, I&#8217;m fine with &lt;div&gt;; I just wish sometimes it had some common sense.   And just like a former cigarette smoker might occasionally step out behind the house and indulge in the guilty pleasure of an old bad habit, I reserve the right to use tables occasionally in my own work.</p>
]]></content:encoded>
			<wfw:commentRss>http://chapter42.whitewhale.net/2008/06/19/tables-and-css-columns-part-i/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iepngfix.htc</title>
		<link>http://chapter42.whitewhale.net/2008/06/04/iepngfixhtc/</link>
		<comments>http://chapter42.whitewhale.net/2008/06/04/iepngfixhtc/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 17:30:47 +0000</pubDate>
		<dc:creator>Donald</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[png]]></category>

		<guid isPermaLink="false">http://chapter42.whaleblogs.net/?p=28</guid>
		<description><![CDATA[Internet Explorer 6 is a web development headache for many reasons, but its lack of support for PNG alpha transparency is one of the most grating. It's more-or-less a given that any cutting-edge design (even <a href="http://www.kenyon.edu/">a relatively minimalist one</a>) is going to have a place where one layer shines through another, or a single transparent image should be matched to multiple background colors, or—most commonly—anti-aliased text is placed over a photo or texture.

Getting these PNGs to actually be transparent is no longer a major issue—we've used a few different approaches over the years, but settled on Angus Turnbull’s <a href="http://www.twinhelix.com/css/iepngfix/">iepngfix.htc</a> as the most straightforward drop-in solution out there. The way it works is just really smart.

But while building out some recent client projects, we just couldn't get it to catch...]]></description>
			<content:encoded><![CDATA[<p>Internet Explorer 6 is a web development headache for many reasons, but its lack of support for PNG alpha transparency is one of the most grating. It&#8217;s more-or-less a given that any cutting-edge design (even <a href="http://www.kenyon.edu/">a relatively minimalist one</a>) is going to have a place where one layer shines through another, or a single transparent image should be matched to multiple background colors, or—most commonly—anti-aliased text is placed over a photo or texture.</p>
<p>Getting these PNGs to actually be transparent is no longer a major issue—we&#8217;ve used a few different approaches over the years, but settled on Angus Turnbull’s <a href="http://www.twinhelix.com/css/iepngfix/">iepngfix.htc</a> as the most straightforward drop-in solution out there. The way it works is just really smart.</p>
<p>But while building out some recent client projects, we just couldn&#8217;t get it to catch. We checked and double-checked the file paths, and re-exported the PNG images, and finally copied a working example from a live client site, but nothing seemed to do it. Because IE has no decent debugger, I removed the conditional comment to see what I could learn in <a href="http://www.getfirebug.com/">Firebug</a>.</p>
<p>It turns out that our staging server sends the <em>.htc</em> file as <em>text/plain</em>, while the working client version was serving <em>text/x-component</em>. Changing out server config to mimic this fixed the problem. Later, some Googling revealed that the release notes for the <a href="http://www.twinhelix.com/test/">newest beta version</a> address this (and even include a PHP solution that serves the file while sending the correct headers).</p>
<p>There are still a whole host of limitations: no repeating images, weird layering glitches that happen even in IE7, and really bizarre link clickability issues. But iepngfix gets far enough to solve 90% of the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://chapter42.whitewhale.net/2008/06/04/iepngfixhtc/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CSS optimization</title>
		<link>http://chapter42.whitewhale.net/2008/05/15/css-optimization/</link>
		<comments>http://chapter42.whitewhale.net/2008/05/15/css-optimization/#comments</comments>
		<pubDate>Thu, 15 May 2008 16:35:08 +0000</pubDate>
		<dc:creator>Donald</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[bestpractices]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[efficiency]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://chapter42.whaleblogs.net/?p=20</guid>
		<description><![CDATA[I spoke briefly about our particular CSS formatting structure in my last post. But here&#8217;s something else that&#8217;s been on my mind a lot.
At White Whale, we&#8217;re of course always thinking about code efficiency: less queries, less code, fewer requests, et cetera. And much of this on the design side is rote best practices (semantics, [...]]]></description>
			<content:encoded><![CDATA[<p>I spoke briefly about our particular CSS formatting structure in <a href="http://chapter42.whaleblogs.net/?p=14">my last post</a>. But here&#8217;s something else that&#8217;s been on my mind a lot.</p>
<p>At White Whale, we&#8217;re of course always thinking about code efficiency: less queries, less code, fewer requests, et cetera. And much of this on the design side is rote best practices (semantics, accessibility, compatibility). But I still find myself sweating more nitty-gritty details, so I was fascinated to see <a href="http://jpsykes.com/152/testing-css-performance-pt-2">jpsykes&#8217; analysis</a> of this one. The question boils down to, &#8220;How specific should I get with CSS selectors?&#8221;<span id="more-20"></span></p>
<p>We have:<br />
<span class="code">#header #navigation .portal  { font-weight:bold; }</span><br />
vs.<br />
<span class="code">.portal { font-weight:bold; }</span><br />
I&#8217;ve leaned toward the first on a gut feeling; <span class="code">.portal</span> will only ever appear in <span class="code">#navigation</span> in <span class="code">#header</span>, so why not tell the browser where to look? But intuition is wrong in this case. Check out the graph (again, via <a href="http://jpsykes.com/152/testing-css-performance-pt-2">jpsykes</a>):<br />
<a href="http://www.whitewhale.net/wordpress/wp-content/uploads/2008/05/data-chart.png"><img class="alignnone size-full wp-image-21" title="CSS optimization chart" src="http://www.whitewhale.net/wordpress/wp-content/uploads/2008/05/data-chart.png" alt="CSS rendering times in browsers for two selector methods" width="500" height="375" /><br />
</a></p>
<p>Giving <em>more</em> selector specificity causes performance hits across all the major browsers. What&#8217;s happening is that the browser actually starts at the right-hand side of the selector and searches backwards. So it finds all instances of <span class="code">.portal</span>, then climbs up the DOM to make sure it&#8217;s in <span class="code">#navigation</span>, then filters again for <span class="code">#header</span>. (You&#8217;ll see that FF3 seems to perform best overall, but that&#8217;s a little misleading for reasons a commenter notes <a href="http://jpsykes.com/152/testing-css-performance-pt-2#comment-846">here</a>. Check out the results with <a href="http://jpsykes.com/153/more-css-performance-testing-pt-3">a better control</a>.)</p>
<p>Interestingly, the opposite effect is true for JS frameworks. Their selector implementations &#8212; we use jQuery at White Whale &#8212; tend to process the selectors from left-to-right: first finding <span class="code">#header</span>, then looking inside it for <span class="code">#navigation</span>, and then inside that for any instances of <span class="code">.portal</span>. So those work best when coded with some specificity.</p>
<p>It&#8217;s important to note here that we&#8217;re talking fractions of a second on a page with 20,000 test elements. So until we start serving 20,000 database records on a single page, our best practice will be whatever makes it easiest to keep the code straight in our own minds and for our clients &#8212; but I can&#8217;t help but think I&#8217;ll be subconsciously affected by the knowledge that every <span class="code">.newslist li .summary</span> might shaving precious milliseconds off our load time.</p>
]]></content:encoded>
			<wfw:commentRss>http://chapter42.whitewhale.net/2008/05/15/css-optimization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>

