The True Advantage of CSS
Published on Sep 8, 2009 (updated Feb 5, 2024), filed under development (feed). (Share this on Mastodon or Bluesky?)
This and many other posts are also available as a pretty, well-behaved ebook: On Web Development.
Despite CSS being around for a long, long time, there are still some myths around it. Reading Mike’s post on CSS evangelism again I couldn’t only relate to Mike’s concerns, I also felt reminded of what I’ve been… saying in a lot of talks and discussions: The advantages of CSS tend to be misunderstood.
The main advantage of CSS is that it allows to separate concerns; it makes documents and their presentation more maintainable. End of story.
Much of what’s otherwise said follows from this. The accessibility card doesn’t count as there’s no correlation between use of CSS and accessibility. That is, a site defining all presentation in style sheets must not necessarily be accessible, and a site jam-packed with presentational markup making no use of CSS whatsoever must not necessarily be inaccessible.
The performance card won’t necessarily win anything, either. There are situations when going for presentational markup and making no use of external style sheets (which also mean at least one additional HTTP request) even offers faster load times.
Similar with the SEO card. The mere use of CSS doesn’t mean anything for your HTML. The markup can be garbage, it can be gold.
The cost card, speaking hosting, is not an ace, it’s more like a 7 or 8. Hosting costs depend on other factors than use of CSS. Hosting, let’s face it, is not expensive anymore.
The job security card, to explore what else is also regularly expressed, is a different animal. People who understand web development would focus on and hire only capable web developers who thus, yes, are able to write decent CSS and equally solid HTML (and maybe have a website). Given that and that web dev and hiring managers learn from mistakes, too, CSS expertise should mean some job security.
The maintainability card—which includes the “faster|cheaper|cooler redesign|relaunch” ones, and so here I disagree with Mike—wins about every single contest. No matter how crappy the HTML code is, CSS (and here I’m, for simplicity, boiling CSS down to external, centralized style sheets) always makes maintenance easier and cheaper. The practical impact can vary a lot, from “barely noticeable” to “wow, you did this all by just updating your style sheets,” yet just linking an external style sheet can already help maintenance. And being in this situation is the main advantage of CSS.
More on maintainability? The maintainability guide shares a few additional ideas.
About Me
I’m Jens (long: Jens Oliver Meiert), and I’m a web developer, manager, and author. I’ve worked as a technical lead and engineering manager for small and large enterprises, I’m an occasional contributor to web standards (like HTML, CSS, WCAG), and I write and review books for O’Reilly and Frontend Dogma.
I love trying things, not only in web development and engineering management, but also in other areas like philosophy. Here on meiert.com I share some of my experiences and views. (I value you being critical, interpreting charitably, and giving feedback.)