Skip to content

24 ways to impress your friends

Vote down?

Drew McLellan

Halans – that’s a fair point, I think. Using semantic names for the constants is probably a good idea.

However, there’s a big difference between naming constants within a CSS file and choosing class names or IDs within a document. A key idea behind separating content and styling is that you can change one without affecting the other. You can redesign your site (to turn the greys blue or whatever) by attaching a new stylesheet to the document. That stylesheet in turn would have its own constants with their own names.

Those constants are restricted to the scope of the stylesheet where they are truly appropriate. The presentation layer (CSS) is exactly where it’s okay to talk of how something looks.