multiple css

T

the idiot

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.
cheers
 
V

Vincent

the said:
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.
cheers

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
document.
- 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.
 
J

jake

the idiot said:
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.
cheers
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.)


regards.
 
I

Isofarro

the said:
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.

Quite a number of reasons. Separating global styles from page specific
styles. It may also be good to have one style for "design" and a
corresponding one that offers readable content.

Also offering different stylesheets to different devices - for example a
print specific stylesheet, a projector specific stylesheet. Keeping them in
separate stylesheets does help keep maintenance overheads low.
 
T

the idiot

Vincent said:
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
document.
- 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.
thankyou very much sir. i am non the wiser but intrigued enough to
investigate properly. thanks again.
 

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
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top