Is bloated CSS the new HTML?

Ethan Marcotte's recent rambling on the potential for bloated CSS brings up an interesting quandary: as we move to a more semantic web and HTML gets streamlined, are we simply increasing the complexity and, more importantly, the size of our CSS files to the point where it negates the value of it? Dave Shea talks of 50k CSS files but is this an issue?

Ethan talks of the extra div's, span's and hacks that we have to add to achieve the designs we want. But a true semantic web would do away with this extraneous code and in doing so would increase the size of CSS even more.

So what's the solution? Ethan suggests a halfway point between the design's of now (with the id's and class's and the design's) and design's of the future (with new powerful selectors). I don't think this is far off from the truth. Id's will almost always need to exist to identify key areas of the content. How else will we know to style different areas of the page? Things like navigation bars, ad space, sidebars and so on all need to be identified in one form or another. Classes will always be there to format areas of the content that cannot be addressed through a specific HTML tag. For example, perhaps there is a list of items on a page but you wish to float it to the right and allow the text to flow around it. Certainly not all lists should be presented as such but a class applied to this list would be appropriate.

The issue of size, however, seems to be a non-issue. The extra selector's along with more compliant browsers should help minimize the hacks and extraneous CSS that is necessary to create the masterpieces that are our designs. For those that do have more complex and meatier CSS files, the benefits are the same for CSS in general:

  • file caching: once the CSS file is cached, each streamlined HTML file will be that much faster to download;
  • faster development: with an even greater seperation of content and design, future design changes will be that much easier and faster to make.

I don't think we have much to worry about.

Published October 27, 2003 · Updated September 17, 2005
Categorized as HTML and CSS
Short URL: https://snook.ca/s/35

Want to learn about scaling CSS for large projects?

I'm available for full and half-day workshops on scalable CSS architecture. I can provide on-site training for your team. Interested?
Get in touch.