Topic: How does CSS Load? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=10907" title="Pages that link to Topic: How does CSS Load? (Page 1 of 1)" rel="nofollow" >Topic: How does CSS Load? <span class="small">(Page 1 of 1)</span>\

 
H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 02-12-2003 13:28

Heya's all.

Does anyone know how CSS loads when you open up a page. Say i have a link to a temp.css file, as soon as i open that page does it load the entire CSS file, or does it just grab the parts which are used in that page.

What im getting at i guess, is it better to have say 10 smaller css files for each page considering some wont use things that other pages do, or is it ok to have 1 Larger CSS file that handles everything. I know css files are pretty small, but if it loads the entire css file including parts that arent used then maybe its worth splitting it up a bit.

Thanks all, what do you think?

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 02-12-2003 13:36

H][RO: What happens is that the browser grabs the file, caches it and goes through it and interprets the the rules in your CSS file and applies it to your page.

The crucial bit is the caching - if you have one large sitewide stylesheet then it is downloaded once and then cached which makes things quicker for each page.

It might make things ever so marginally quicker to assign different smaller stylesheets to different pages but the extra time in having to go and fetch it each time would certainly counteract any possible advantage there might be in that method.

So use one big file where possible.

___________________
Emps

FAQs: Emperor

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 02-12-2003 18:32

Not to mention the confusion of having several different style sheets to dig through when you're creating/editing your pages, and the probability of having to repeat code in multiple files.

It defeats the purpose of using a style sheet really.

Multiple style sheets have their uses - different styles for diferent media (ie: screen/print) for instance, but not in the sense that you are talking about

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 02-12-2003 18:38

Not to mention text is relatively cheap in terms of bandwidth (Used properly CSS should reduce your HTML code significantly as well) so you're not getting too hit with a large file.



.:[ Never resist a perfect moment ]:.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 02-12-2003 18:56

So what it really comes down to is, you shouldn't have so much CSS that downloading it is a problem. If you do, then you need to figure out why, because you really never need that much CSS.

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 02-12-2003 23:41

Ahh thats great, exactly what i was hoping was the case :P..

I know its not really an issue because of the smallish size but i guess i was just curious, but yeh your right slime there shouldnt be all that much in there.

The css file for my page is about 10k, and thats with pretty much everything i need so i think thats ok, 10k is nothing really, just good to know how it works.

Thanks All.

H][RO.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu