The Stupidest Style Sheet Name Ever

Published on March 25, 2009 (↻ February 5, 2024), filed under (RSS feed for all categories).

This and many other posts are also available as a pretty, well-behaved ebook: On Web Development.

The last name you want to pick for your style sheet is “style.css”.

Why is “style.css” such a poor CSS file name? The main reason is maintenance. There’s quite a probability—and as we know, web development is all about probability—that even if “style.css” is your project’s only style sheet, more style sheets may follow. (My experience makes me estimate that more than 60% of websites actually use more than one style sheet.)

Only a single additional one would make the name “style.css” look odd at best, as every style sheet contains “styles.” An additional style sheet would either force you to rename “style.css” (and thus force you to update everything referring to that file, too) or confront you with that lapse until the end of time. Both is unnecessary, and hence silly.

It’s true that similar to reasonable ID and class names, functional or generic style sheet names are cool, however “style.css” is not “generic.” Sure-fire core style sheet names are “standard.css” and “default.css” while there are always functional names à la “corporate.css” or “gallery.css” to use, too.

Getting style sheet naming right, which evidently is one piece of the HTML and maintenance puzzle, is not difficult. Start with avoiding names like “style.css”.

Was this useful or interesting? Share (toot) this post, or maybe treat me to a coffee. Thanks!

About Me

Jens Oliver Meiert, on September 30, 2021.

I’m Jens, and I’m an engineering lead and author. I’ve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, I’m close to W3C and WHATWG, and I write and review books for O’Reilly and Frontend Dogma.

With my current move to Spain, I’m open to a new remote frontend leadership position. Feel free to review and refer my CV or LinkedIn profile.

I love trying things, not only in web development, but also in other areas like philosophy. Here on meiert.com I share some of my views and experiences.

Comments (Closed)

  1. On March 25, 2009, 23:45 CET, Neal G said:

    I always name mine after the media type I apply to it, which is almost always “all” so I therefore name my master style sheet all.css, which I include @media type for screen, print, handheld, aural.

  2. On March 26, 2009, 0:26 CET, Louis said:

    I think that style.css is perfectly fine for personnal websites like this very blog for example. Wise people know that the HTTP requests are the evil, so they try to concatenate to the maximum.

    I used to have one main style.css file and it was the perfect fit. Now I serve my css inline as I’ve calculated that it’s even faster — and maintenance is not a problem for a personnal weblog.

  3. On March 26, 2009, 1:42 CET, Robert said:

    Jens, is my feeling of this being a rather banal entry not on par with your usual level of content quality a singularity of myself, or do you feel the same?

    File names, OMG. What level of abstraction have we left behind the last decade?

  4. On March 26, 2009, 8:29 CET, Jens Oliver Meiert said:

    Neal, interesting… I wanted to ask what you’ll do when you, say, go from screen to screen, projection (a legit concern I think), but “all.css” appears to be immune against that.

    Louis, I typically like the idea of separating maintainability and performance. What you’re saying is better just have one style sheet to save HTTP requests, right? There might be several reasons why to split style sheets, yet having several of them doesn’t have to mean that you’re serving them separately.

    Robert, I very much appreciate your concern, I really do đŸ˜Š As I wrote, this looks like a trivial (at least “not difficult”) topic, and several web developers might actually never run into any issues, but certain file names (like “style.css”, but also “screen.css”) mean a higher chance of avoidable document changes—aka maintenance problems. Just stay with me, it should get a bit clearer soon đŸ˜Š

  5. On March 26, 2009, 9:14 CET, Kroc Camen said:

    I mod_rewrite mine to http://camendesign.com/design/ đŸ˜›

  6. On March 27, 2009, 18:45 CET, Louis said:

    @Jens: for a small sized weblog, I find the all-in-one-css-file approach very convenient.

  7. On April 23, 2009, 13:17 CEST, yomi said:

    u are absoluetly right

  8. On June 14, 2009, 2:30 CEST, Olivier said:

    “My experience makes me guess that more than 60 % of web sites actually use more than one style sheet.” doesn’t mean anything. As if experience could make you guess something subjective.

  9. On June 14, 2009, 3:42 CEST, Jens Oliver Meiert said:

    Olivier, point taken, this is poorly phrased. The observation correlates with the data I gathered analyzing CSS use of the Alexa Top 10; for the Alexa Top 10, it’s currently 50%.