The Stupidest Style Sheet Name Ever
Published on March 25, 2009 (⻠February 5, 2024), filed under Development (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â.
About Me
Iâm Jens (long: Jens Oliver Meiert), and Iâm a frontend engineering leader and tech author/publisher. Iâve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, Iâm a contributor to several web standards, 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. (Please be critical, interpret charitably, and give feedback.)
Comments (Closed)
-
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.
-
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?
-
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
toscreen, 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 đ
-
On March 26, 2009, 9:14 CET, Kroc Camen said:
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.
-
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%.
Read More
Maybe of interest to you, too:
- Next: Why CSS Needs No Variables
- Previous: CSS: Style the Non-Obvious
- More under Development
- More from 2009
- Most popular posts
Looking for a way to comment? Comments have been disabled, unfortunately.
Get a good look at web development? Try WebGlossary.infoâand The Web Development Glossary 3K. With explanations and definitions for thousands of terms of web development, web design, and related fields, building on Wikipedia as well as MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.