Combining stylesheets (or not)

J

Jim Scott

I have recently converted my site to using stylesheets.
I use five. One is concerned with buttons and refers to most pages. The
others relate to table layout. The main one of these refers to every page
and the others, when I need a different size or border.
Is there any virtue in combining them in to one master stylesheet?
If the answer is yes, is it as easy as just putting all the bits together?
 
R

Roy Schestowitz

Jim said:
I have recently converted my site to using stylesheets.
I use five. One is concerned with buttons and refers to most pages. The
others relate to table layout. The main one of these refers to every page
and the others, when I need a different size or border.
Is there any virtue in combining them in to one master stylesheet?
If the answer is yes, is it as easy as just putting all the bits together?

===
Pros of separating:

Fragmented -> Easier to change locally, without affecting many other
elements
Fragmented -> Can be difficult to manage
Where only few sheets are used, bandwidth is lower

===
Cons of separating:

More files -> slower to download
More files -> scattered code
Alternative stylesheets might be hard to manage


I suggest you carefully think /how/ stylesheets should be separated. It will
be tedious to change in the future. I sometimes embed CSS in the HTML files
to avoid the "change in one affects another".

Roy
 
J

Jim Scott

===
Pros of separating:

Fragmented -> Easier to change locally, without affecting many other
elements
Fragmented -> Can be difficult to manage
Where only few sheets are used, bandwidth is lower

===
Cons of separating:

More files -> slower to download
More files -> scattered code
Alternative stylesheets might be hard to manage


I suggest you carefully think /how/ stylesheets should be separated. It will
be tedious to change in the future. I sometimes embed CSS in the HTML files
to avoid the "change in one affects another".

Roy

Thanks.
I could possible reduce the external ss to two, and include the 'table
tweakers' in the html.
 
N

Nico Schuyt

Thanks.
I could possible reduce the external ss to two, and include the 'table
tweakers' in the html.

You *always* need at least two stylesheets. One for the displaying on screen
and one for printing.
Like Roy I put all the markup in the external stylesheet and if it's
specific for one file in the page itself.
 
A

Andy Dingley

You *always* need at least two stylesheets. One for the displaying on screen
and one for printing.

You can also do this within one stylesheet. Use @media print {} inside
the stylesheet itself. That way you still only need a single <link> on
each page and you can manipulate the stylesheet's behaviour for a whole
site for changing one centralised CSS location, not each page.
 
A

Andy Dingley

How is browser support of that?

Good enough. It's the level of feature where I want the mainstream
browsers to behave with it, but I can leave with the really obscure ones
breaking it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top