Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- multiple css
- the idiot
October 21, 2003, 1:17 pm
rate this thread
Re: multiple css
First, you have to make the distinction between three types of external
stylesheets, depending of they are linked to your document:
- <link rel="stylesheet" type="text/css" href="stylesheet.css"> : this
defines a persistent stylesheet which is always used by your document,
- if you add a title attribute to the <link> element, then you define a
default stylesheet that's used... by default when a user retrieves your
- if, with the title attribute, you use rel="alternate srylesheet"
instead of the plain "stylesheet" relationship, you define a stylesheet
that the user can switch to if he wants (and if his UA is smart enough
to provide an interface to do that: Mozilla is)
So basically, you can define multiple stylesheets to give users the
possibility to choose the style they prefer, persistent stylesheet being
used to share common properties between alternate stylesheets.
This is cool, but even better: you can also use the media attribute to
"specify how a document is to be presented on different media: on the
screen, on paper, with a speech synthesizer, with a braille device,
etc." (I'm quoting the spec: http://www.w3.org/TR/CSS21/media.html )
For example, use media="screen" for visual UAs, media="print" to specify
how your document should look like on a paper, etc.
to email me, add "poinot" before the at-sign in my
address and wanadoo after it...
Re: multiple css
No such thing as a stupid question.
One simple example (3 sheets):
1 style sheet for the page
1 style sheet specifically to handle older browsers (i.e. Netscape 4)
1 style sheet for printing (media="print")
Another example (2 sheets):
1 style sheet global to the site
1 style sheet local to this page
(The first 'C' in CSS means 'cascading'; the browser sets up the styling
in the order in which it reads the style sheets. The final styling is a
combination of what's in the 2 style sheets.)