[thelist] CSS Hack? (was .css files vs inline CSS and .js vs inline JS?)

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Wed May 18 00:11:50 CDT 2005


	But wasn't the whole point of this thread to reduce download
time by putting the stuff in one file that gets cached so the page
DOESN'T have to download everything again?

-----Original Message-----
From: thelist-bounces at lists.evolt.org On Behalf Of Sam Foster

>> Is that truly a hack? Is there a more elegant way to do this?
>
>
> Yup. Add id="home" to the body tag of your home page, then add this to
> your main stylesheet:
> body#home {
>     background-color: #FFFFFF;
>     background-image: none !important;
> }
>
great, now every single page has to download all this extra fluff. If 
the rule is intended for one page, the rule belongs in the head of that 
page.
For practical purposes, putting it in an external stylesheet can be 
useful - particularly if you aren't the owner of the html (e.g. its 
generated on the server-side, or maintained by someone else)  .. but if 
we are just talking about download speed, cacheing and so on the ideal 
case is that only relevant rules should be downloaded per page.

Ideals rarely come into it however, so do whatever works :)

Sam





More information about the thelist mailing list