Jens Meiert

The Stupidest Style Sheet Name Ever

Jens Meiert, March 25, 2009.

This entry is filed under .

This might irritate some people, however one of the last names you might want to pick for your style sheet is “style.css”.

Why is “style.css” such an inadvisable CSS file name? The main reason’s maintenance. There’s quite some probability – and as we all know, web development is a lot about probability – that even if “style.css” is your project’s only style sheet, more style sheets will follow. (My experience makes me guess that more than 60 % of web sites 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.

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

In any case, expect additional traps and tips regarding style sheet file names and maintenance to show up very soon. Getting style sheet naming right, which evidently is one piece of the HTML and maintenance puzzle, is not difficult, but apparently more difficult than one might think.

Read More

Enjoy the most popular posts, probably including:

Comments

  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 Meiert said:

    Neal, interesting … I already 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 like to say 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/ :P

  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 March 31, 2009, 15:53 CEST, Jens Meiert said:

    Kroc, I knew you would ;)

    Louis, oh, it sure is :) (What I’m saying is that people should consider avoiding issues by unwise CSS file names.)

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

    u are absoluetly right

  9. 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.

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

    Olivier, interestingly, the data I gathered analyzing CSS use of the Alexa Top 10 pretty much correlate with the 60 % assessment (for the Alexa Top 10, it’s currently 50 %.)

    (Other than that, I should have said “my experience tells me.”)

Leave a Comment

Leave a Comment

Respect the comment guidelines. HTML allowed: <a href=""> <abbr title=""> <blockquote> <code> <em> <strong>

Found a mistake? Reward! Email me, jens@meiert.com.

You are here: meiert.com – Archive for 2009 – The Stupidest Style Sheet Name Ever

Last update: March 25, 2009. Copyright 2000-2010 Jens Meiert.