Help - Search - Members - Calendar
Full Version: "style2, style4, style7, style 12, etc."
HTMLHelp Forums > Web Authoring > Cascading Style Sheets
robby
I've noticed in certain stylesheets, the author uses a classname of "style#." That's understandable since you're going to use quite a few classes over and over. What I can't understand is the significance behind the numbers of each. An example of that is in the title of this thread. Why don't stylesheet authors simply use "style 1, style2, style3, style4?"
pandy
Maybe they are stupid. Or they have copied the styles from somewhere and think the name is somehow important. Or they have deleted the rules that are missing from the series.

That's one reason pointless class and ID names like that are no good. These have no meaning whatsoever if you rearrange things for example. Then they would become utterly confusing. It's better to use names like header, footer, nav, links... Everything that alludes to colors, order, direction (except footer and header happy.gif ) is dumb because those things may change. No fun when redbox is blue, left is right and so on.

Using names that are at least somewhat semantic or if nothing else describe the element(s) they refer to in a way that's meaningful to yourself is better. And now I don't mean how they happen to look, but the function they have.
pandy
I think it also comes from that people tend to use way too many classes instead of using smarter selectors. If you use a few strategic IDs you can get to almost everything through contextual selectors (like '#content p', '#footer p' and so on). Then you don't need to come up with so many names and can think of enough good ones.
Tom H.
I've seen that in pages created with DreamWeaver. Other software thinks it's helpful by suggesting "New Page 1" for the title of a new page.
pandy
Ah, that figures.
robby
I was thinking it had something to do with Dreamweaver. Although I like the explanation that they are just stupid. tongue.gif
pandy
Yeah, that always works for me too. biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.