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

Sarah Sweeney mr.sanders at designshift.com
Wed May 18 07:30:01 CDT 2005


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

In the interests of separating style and content as well as taking 
advantage of caching, I think all the css should be in a separate file 
(or files). In this case, I wouldn't worry about the tiny bit this would 
add to the size of the main css file, but if there were enough special 
styles just for the home page, then I might separate them out into 
another stylesheet and include that in the page as well - but I still 
wouldn't just plunk a <style> block into the head of the page.

-- 
sarah sweeney
web developer & programmer
my portfolio: http://sarah.designshift.com
my blog: http://hardedge.ca
my family: http://geekjock.ca


More information about the thelist mailing list