The C in CSS
Adactio says that they’ve started added an ID to the body tag of their various page types. This way that can have all their CSS in one file, and still maintain different looks for different page types.
So i guess the CSS would look like this.
<style>
#top_page h1 {
font-family:arial;
font-size:2em;
}
#internal_page h1 {
font-family:verdana;
font-size:.83em;
}
<body id="top_page">
<h1>Welcome to Yahoo</h1>
</body>
<body id="internal_page">
<!-- maybe a news article page -->
<h1>Kerry narrowly wins Wisconsin</h1>
</body>
Seems like an interesting approach. We’ve alreayd been doing this, but making the selector-ceiling various container divs instead of utilizing the body tag itself.
Why is having everything in one big file good? Wouldn’t it make more sense to simply include the styles that you actually use in the file and use server side includes to build special things?
I’m not opposed to including id tags for various items since that allows future modifications, including script and DHTML, but I don’t think that bloating CSS files is really all that good an idea either.