multiple css

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
could someone please explain (in non jargon terms because i am easily
confused) why one would link to more than one css on a web page....  is it
just for simplicity? i hope this isnt a stupid question.

Re: multiple css

the idiot wrote:
Quoted text here. Click to load it

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: )
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

Quoted text here. Click to load it
thankyou very much sir. i am non the wiser but intrigued enough to
investigate properly. thanks again.

Re: multiple css

Quoted text here. Click to load it
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.)


Site Timeline