Conditional CSS is a server side script which allows you to target particular browsers within your CSS files. The script detects a visitor’s browser and then parses your css files, removing the conditional statements and any lines that aren’t meant to go to that browser. I think I like this more than traditional browser filters but less than using conditional comments to serve an extra stylesheet with overrides to Internet Explorer. I haven’t tested it to determine how much of an issue the additional processing overhead is, so I’m not sure how usable it is. It’s an interesting technology and is available for multiple platforms including PHP and C. The C version is apparently very fast.
Category Archives: CSS
The Problem With Em-Based Layouts
I was recently working on a project and thought it might be interesting to try out an em-based layout (where the layout of the entire site changes based on the font size.) I was hoping to preserve ideal line-length for my copy. The geek cred associated with em-based layouts was also appealing–earlier this year it seemed like they were all the rage. This trend may have been kicked off by the brilliant Mr. Dan Cederholm, a personally hero of mine in the web development community–as silly as that may sound.
It occurred to me, however, that there’s a fundamental flaw in the logic of an em-based layout. As a visitor increases the size of the text on screen, the layout will increase in width so that everything remains in proportion. Now I’m generalizing here, but if a visitor needs to bump up the text size to read it, it’s possible (perhaps even likely) that they could be older and potentially less technical than us web developers with our 20+ inch monitors. As the text size (and therefore layout width) increases, these users with their smaller monitors will run out of room to grow pretty quickly. This causes dreaded horizontal scrolling which no one likes, no matter what designers may have told you in the late 90s.
Roger Johansson acknowledged this flaw on his blog and suggested that by setting a maximum width in pixels you could prevent this issue. The problem that is titular to this post, though, is that this just doesn’t seem to work. It’s possible that it did work at one time, but I’ve tested many layouts online in addition to my own test case and found that in recent versions of Firefox the layout expands unchecked, causing horizontal scrolling. Perhaps this feature was broken during recent updates to Mozilla’s rendering engine. Unless I’m missing something em-based layouts are self-defeating as it stands. So are they anything more than geek-chic?
Dustin Tigner points out in the comments that something has changed in firefox 3. It now uses page zooming by default. If you enable text-only zooming these layouts start to work again. That begs the question, however: With browsers moving toward page zooming by default, how much longer will em-based layouts be a practical use of our time? I think in some cases page zooming provides a worse user experience than a well-coded em based layout (see http://www.456bereastreet.com/ as an example,) and as a default it tends to override those careful layout considerations.
Blueprint CSS Framework
Last week, a CSS framework called Blueprint was released to the web, and it has since garnered some attention from some heavy hitters in the web design world. The author is Olav Bjørkøy. The framework features styles for a customizable grid and typographic baseline, some other basic typography, and basic print styles.
I’ve never been wild about using CSS grid frameworks because they invariably use presentational class names instead of semantic ones, describing the design instead of the content. Still, Blueprint might be a great way to jumpstart a project. I’m excited to give it a shot.