CSS separates layout from content less than you'd like

May 9, 2007

It is generally an article of faith that once you switch to (properly done) CSS, you can do significant layout changes without having to change your content. Unfortunately I believe that this is somewhat of a myth in practice.

In practice, what you can do with CSS alone is limited to how your content is structured and tagged with things like CSS classes and ids. And the problem is that generally, people do not obsessively structure and tag their content; they mark it up and tag it for what their CSS currently needs, with a side helping of tagging for changes they think they might want to make in the future.

(This shouldn't surprise anyone, since people strongly resist doing extra work that seems (at the time) unlikely to ever be used. In fact, obsessively creating tagged markup that you don't see a need for is really a case of premature optimization.)

Thus on most sites there are fairly strong limits on what can be done with CSS changes alone; going beyond this needs some content changes. If you're in luck, all you need is for existing structures to be tagged so you can yank them around. If you're unlucky, you need structural changes that add new <div>s or <span>s.

In other words, what you get from CSS in practice is that it is easier to make layout changes that you were already thinking about (and thus built hooks for into your content). This is not a bad thing, but it is far from the panacea that common CSS folklore makes it out to be.

(The way to test this is not to look at example sites, but to get something like Stylish and wander around trying to make changes to random sites with CSS-based layouts.)

Written on 09 May 2007.
« Supporting the real world
The other problem with network booting »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Wed May 9 23:24:18 2007
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.