The Stupidest Style Sheet Name Ever
Post from March 25, 2009 (↻ June 10, 2021), filed under Web Development.
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”.
I’m Jens Oliver Meiert, and I’m an engineering lead (currently manager for Developer Experience at LivePerson) and author. I’ve worked as a technical lead for Google, I’m close to W3C and WHATWG, and I write and review books for O’Reilly. I love trying things, sometimes including philosophy, art, and adventure. Here on meiert.com I share some of my views and experiences.
If you have questions or suggestions about what I write, please leave a comment (if available) or a message.
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.
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.
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?
I mod_rewrite mine to http://camendesign.com/design/ 😛
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.
On April 23, 2009, 13:17 CEST, yomi said:
u are absoluetly right
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.
Have a look at the most popular posts, possibly including:
Looking for a way to comment? Comments have been disabled, unfortunately.
Perhaps my most comprehensive book: The Web Development Glossary (2020). With explanations and definitions for literally thousands of terms from Web Development and related fields, building on Wikipedia as well as the MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.