Layout: multiple CSS stylesheets on same page?

started by Rlipnick on Jun 30, 2004 — RSS Feed

Rlipnick Rlipnick
Posts: 2

Very simply, can we have multiple CSS stylesheets on the same page. We want to use several stylesheets for a site we're developing and I assumed if we had them all in the root directory, we can use them?


Baxter Baxter
Posts: 157

Of course you can. But each succeeding one will overwrite rules from the previous. That may or may not be a bad thing depending on your circumstances.

You can also import into one and carry it over that way (in series instead of parallel).

Two quite common uses for multiples is to separate positioning information from color/formatting stuff, or to feed separate stylesheets for print/handhelds/whatever.

Rlipnick Rlipnick
Posts: 2

Thanks for the good explanation.

Joann Joann
Posts: 4

You can also order your stylesheets so taht your pages know which order and when to load them.  The following is a sample of a series of stylesheets called into a page allowing users to contol the font size on pages.

<link rel="stylesheet" href="css/basic.css" type="text/css" media="all" />
 <link rel="stylesheet" href="css/print.css" type="text/css" media="print" />
 <link rel="alternate stylesheet" type="text/css" href="css/large.css" title="A++" />
 <link rel="alternate stylesheet" type="text/css" href="css/medium.css" title="A+" />
 <link rel="alternate stylesheet" type="text/css" href="css/small.css" title="A" />
 <link rel="alternate stylesheet" type="text/css" href="css/x-small.css" title="A-" />
 <link rel="alternate stylesheet" type="text/css" href="css/xx-small.css" title="A--" />

You must login to reply