The Stupidest Style Sheet Name Ever
Published on Mar 25, 2009 (updated Feb 5, 2024), filed under development, css (feed). (Share this on Mastodon or Bluesky?)
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 web developer, manager, and author. Iâve been working as a technical lead and engineering manager for companies youâve never heard of and companies you use every day, 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.)