HighDots Forums  

Linking Multiple Stylesheets

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Linking Multiple Stylesheets in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Don G
 
Posts: n/a

Default Linking Multiple Stylesheets - 03-04-2005 , 02:04 PM






Is it possible to link multiple stylesheets to a single web page? I
have an overall stylesheet for my entire site, but there are a few pages
with a minor differences. I originally had these as inline styles, but
I would like to move them to external stylesheets, if possible.

I did some Google searches, and I found links that seemed to suggest
that multiple stylesheets could be linked to a single page, but didn't
give the details as how to do it.

I have tried code similar to:

<link rel="stylesheet" type="text/css" href="general.css" />
<link rel="stylesheet" type="text/css" href="specific.css" />

But the styles of the second sheet were not applied.

Thanks in advance,

Don

Reply With Quote
  #2  
Old   
Don G
 
Posts: n/a

Default Re: Linking Multiple Stylesheets - 03-04-2005 , 02:35 PM






Nevermind... I did a little more Goolging, and I managed to find a page
describing what needs to be done. The title attribute must be defined
and be the same for all styles that will be used at the same time.

<link rel="stylesheet" type="text/css" href="general.css" title="style1" />
<link rel="stylesheet" type="text/css" href="specific.css" title="style1" />

I did this on my page and it worked like a charm.

Don

Reply With Quote
  #3  
Old   
Steve Pugh
 
Posts: n/a

Default Re: Linking Multiple Stylesheets - 03-04-2005 , 02:38 PM



Don G <mail4dag (AT) yahoo (DOT) com> wrote:

Quote:
I have tried code similar to:

link rel="stylesheet" type="text/css" href="general.css" /
link rel="stylesheet" type="text/css" href="specific.css" /

But the styles of the second sheet were not applied.
That will work. There must be something else going on. Post a URL.

Steve


--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve (AT) pugh (DOT) net> <http://steve.pugh.net/>


Reply With Quote
  #4  
Old   
Vincent Poinot
 
Posts: n/a

Default Re: Linking Multiple Stylesheets - 03-04-2005 , 02:48 PM



Don G wrote:
Quote:
I have tried code similar to:

link rel="stylesheet" type="text/css" href="general.css" /
link rel="stylesheet" type="text/css" href="specific.css" /

But the styles of the second sheet were not applied.
You have to give a title to your specific stylesheet: the general one
will contain permanent rules (rules that always apply), the one with a
title will be your "preferred" stylesheet (as opposed to alternate
stylesheets). So something like this should do:

<link rel="stylesheet" type="text/css" href="general.css" />
<link rel="stylesheet" type="text/css" href="specific.css"
title="preferred"/>


Vincent.


--
Want to spend holidays in France ? Check http://www.relinquiere.com/


Reply With Quote
  #5  
Old   
phil_gg04@treefic.com
 
Posts: n/a

Default Re: Linking Multiple Stylesheets - 03-04-2005 , 03:50 PM



Quote:
link rel="stylesheet" type="text/css" href="general.css" /
link rel="stylesheet" type="text/css" href="specific.css" /
But the styles of the second sheet were not applied.
That will work. There must be something else going on.
Steve, I agree with you. This should work (I do it all over the
place). What's all this about title attributes? I thought that was
something to do with alternate stylesheets. Don G, can you post the
reference that convinced you that you needed a title? Is this a
browser-specific thing?

--Phil.



Reply With Quote
  #6  
Old   
Steve Pugh
 
Posts: n/a

Default Re: Linking Multiple Stylesheets - 03-04-2005 , 04:07 PM



phil_gg04 (AT) treefic (DOT) com wrote:

Quote:
link rel="stylesheet" type="text/css" href="general.css" /
link rel="stylesheet" type="text/css" href="specific.css" /
But the styles of the second sheet were not applied.
That will work. There must be something else going on.

Steve, I agree with you. This should work (I do it all over the
place). What's all this about title attributes?
It's a little bit complicated, see
http://www.w3.org/TR/html401/present....html#h-14.3.2

Quote:
I thought that was something to do with alternate stylesheets.
Yes. Mostly.

If the value of the rel attribute is "stylesheet" and there is no
title then the stylesheet is persistent and will always be applied.
There can be any number of such stylesheets.

If the value of the rel attribute is "stylesheet" and there is a title
then the stylesheet is preferred and will initially be applied. If
there is more than one such stylesheet (with different titles) then
the last specied is used and the others are ignored.

If the value of the rel attribute is "alternate stylesheet" then the
title attributes serves to group these styles together. So the user
can select to apply a group of stylesheets in one go.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve (AT) pugh (DOT) net> <http://steve.pugh.net/>


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.