Click to See Complete Forum and Search --> : how many CSS...


cogumelo
12-16-2004, 08:18 AM
How many external css files should an html file link to?

Is there a recommendation for this?

thx

DaveSW
12-16-2004, 09:51 AM
don'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.

toicontien
12-16-2004, 03:28 PM
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 (http://www.dailytarheel.com/) 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.