Forum Moderators: not2easy

Message Too Old, No Replies

How many css file calls can a page handle?

         

asantos

10:10 pm on Jun 15, 2006 (gmt 0)

10+ Year Member



Hi, im building a CMS, that has lots of CSS files (each CSS has relevant data to what the specific CMS page has to do). Some CMS pages handle lots of actions. For example, in page: album.php im calling 6 css with:
<link rel="stylesheet" type="text/css" media="screen" href="one.css">
<link rel="stylesheet" type="text/css" media="screen" href="two.css">
...
<link rel="stylesheet" type="text/css" media="screen" href="etc.css">

So, the question remains: How many css file calls can a page handle?

4css

10:33 pm on Jun 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From what I just read, you can call as many as you like, but I believe that it can slow things down if you have too many being called in.

Robin_reala

10:41 pm on Jun 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's no theoretical limit, and if there's a practical limit I've never hit it.

4css

10:52 pm on Jun 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



According to Andy Budd's book: CSS Mastery, Advanced Web Standards Solutions
From Chapter 1, Setting The Foundations.
It's worth bearing in mind that every CSS file means an extra call to the server. This can cause a performance hit, so some developers prefer to have one large css file rather than several smaller Ones. The final choice really depends on the situation and is, to some degree a matter of personal preference.

He discusses the different ways that you can set up a style sheet, and the different types that you can have for a site. Interesting book to read.

doodlebee

12:25 am on Jun 16, 2006 (gmt 0)

10+ Year Member



I agree with 4css - Many times, I've found it much easier to have one stylehseet, but if it gets too large for me to easily maneuver through, I'll split them up. For example, I did one site where I needed to create almost an entire separate stylesheet for a shopping cart for a client - he wanted it to "match the site" - but the shopping cart was entirely in tables while the site was tableless. So I created a separate stylesheet specifically for the form fields in the shopping cart, but used the main stylesheet to set the backgrounds and fonts and such.

As Robin said, if there *is* a limit, I've never hit it either - and I've had as many as 6 separate stylesheets on a site before (although, for my personal preference, that *is* a lot - but sometimes necessary to maintain sanity!)