Forum Moderators: not2easy

Message Too Old, No Replies

Multiple StyleSheets not recognized?

         

JAB Creations

2:00 am on Apr 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm currently using this code for my main stylesheet...
<link href="themes/classic/style.css" media="screen" rel="stylesheet" title="city" type="text/css" />

...and when I add a second link to patch most browsers it doesn't take. I'm sure this is really simple but how do I have to do to get a second stylesheet to work in Firefox/Opera, etc?

- John

JAB Creations

2:52 am on Apr 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To get multiple simultaneous stylesheets to work across all browsers the main stylesheet should not have a title while the (in my case) patch stylesheets should have a title attribute.

Presto (Opera 9)

<link href="themes/classic/style.css" media="screen" rel="stylesheet" type="text/css" />
<link href="themes/classic/style-opera9.css" media="screen" rel="stylesheet" title="Opera 9 Patch" type="text/css" />

Gecko (Firefox)

<link href="themes/classic/style.css" media="screen" rel="stylesheet" type="text/css" />
<link href="themes/classic/css3-gecko.css" media="screen" rel="stylesheet" title="Gecko CSS3" type="text/css" />

According to the W3C [w3.org] spec...

Cascading style sheet languages such as CSS allow style information from several sources to be blended together.

That I already knew, it was simply it's implementation that I was curious about.

- John

Achernar

12:03 pm on Apr 1, 2007 (gmt 0)

10+ Year Member Top Contributors Of The Month



If you read the W3C spec carefully, you'll see that it's how it's suppose to work.

Specify that the style sheet is persistent, preferred, or alternate:

* To make a style sheet persistent, set the rel attribute to "stylesheet" and don't set the title attribute.
* To make a style sheet preferred, set the rel attribute to "stylesheet" and name the style sheet with the title attribute.
* To specify an alternate style sheet, set the rel attribute to "alternate stylesheet" and name the style sheet with the title attribute.

JAB Creations

8:30 pm on Apr 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That is what I read and only figured out after it worked. Figuring out the W3C's site is still a bit of a challenge even after reading it's references for the past few years.

- John