On Thursday, March 4, 2004, at 02:53 PM, Adam Carmichael wrote:


Beau wrote:

James Ellis said:
You could also divide your stylesheet up into different files - one for
navigation, one for layout, one for headings etc etc - then link (or
however you do it) them all in.
I would have thought that from a general performance perspective, splitting
the CSS into too many files would be a bad idea, since each one is going to
require an extra HTTP Request/Response to download. That extra traffic will
cost you bytes (and time), so if you need all that CSS on the page, you may as
well have it all in one file.

A few hundred bytes at the _very_ most. Considering that most of the time you won't be loading blog.css, screenreader.css, projector.css, print.css and whatever else, you will be saving that transfer time and data easily. In a world of 56K modems even, 300 bytes (let's say you're sending a LOT of http headers [and for a stylesheet why would you?]), would still take under 0.04 seconds to transfer and in a world of broadband, that's even less. Considering that each stylesheet that you won't be loading up will probably contain more than 300 bytes, it's probably more sensible to split it up.


Besides, it makes for more manageable CSS when you want to edit it.

I totally agree here.


However, one area I haven't looked at is how alternate style sheets (eg color/font/layout changes) are handled with there's multiple (cascading) style sheets in play.

Style-sheet switching with one file (eg screen.css) is easy. But let's pretend that we've got (for screen media):
- base.css (unchanging basic styles)
- fonts-a.css | fonts-b.css (two options)
- layout-a.css | layout-b.css (two options)
- blog.css (specific CSS file for this section)


How do style-switching browsers (eg opera), scripts and whatever else handle all that mess?

---
Justin French
http://indent.com.au

*****************************************************
The discussion list for http://webstandardsgroup.org/
*****************************************************




Reply via email to