<link>
s to stylesheets a title
?In this document I have linked 3 stylesheets. The first makes the heading green, the second italic, the third underlined.
The previous document doesn't have title
s.
Both Opera and Firefox (don't know about Mac browsers) now only apply the first stylesheet, which makes the heading only green. Now you can use a fancy feature, your user agent provides; style switching. We only wanted to give our sheets a title for ourselves, not change the standard cascading rendering behaviour?
Anyway, both browsers follow the specification:
Authors specify external style sheets with the following attributes of the LINK element:
- Set the value of href to the location of the style sheet file. The value of href is a URI.
- Set the value of the type attribute to indicate the language of the linked (style sheet) resource. This allows the user agent to avoid downloading a style sheet for an unsupported style sheet language.
- 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.
User agents should provide a means for users to view and pick from the list of alternate styles. The value of the title attribute is recommended as the name of each choice.
...
If two or more LINK elements specify a preferred style sheet, the first one takes precedence.
Well, it's nice. The only problem is both browsers don't remember what style you selected. Select a different stylesheet (View - Page Style in Firefox) and then go to the next document. It of course remembers which style you prefer. Viewing only one page in a certain style doesn't make sense..
Useless.
If we wan't to provide stylesheet switching we should use some javascript or a server-side check.
Opera is doing some weird stuff; if you add <style[ type="text/css"]>[whatever]</style>
after the last <link>
all sheets are rendered. Check it.