how many CSS...

liunx

Guest
How many external css files should an html file link to?

Is there a recommendation for this?

thxdon't think so. the ideal situation is one stylesheet for screen, one for print etc, but I don't think there is a limit on how many you can have.
Ofcourse if you use the @import hack then you need two for screen, but that's ok.As many files as you deem necessary, just remember that many files may be less efficient because of the number of trips back to the server to Download CSS files. Sometimes, a site is slow not because of a lack of bandwidth to deliver data, but simply because the server is busy. If it takes 4 or 5 seconds for a busy server just to process a request, that's 15 seconds just waiting for the server if all you have is a screen, print, and handheld style sheet.

The number of CSS files needed will all depend on your personal preference and the needs of the project you're working on. Just take a look at how many CSS files The Daily Tarheel's (<!-- m --><a class="postlink" href="http://www.dailytarheel.com/">http://www.dailytarheel.com/</a><!-- m -->) newspaper Web site requires. It's a site I helped develop for their hosting company.

If you go to an article page, the article.css file @import's another CSS file at the beginning of article.css. And article.css is @import'ed directly to the HTML document.

But your project may not require that complexity.
 
Back
Top