Reputation: 4516
I'm currently experimenting with CSS Object Model and try to understand how do all properties and methods of StyleSheet
, CSSStyleSheet
, CSSRule
and all objects of this sort work. I can't figure out why, if I add title
attribute for my <link rel="stylesheet">
elements results in 'switching off' the particular stylesheet while the disabled
property is still set to false
for all stylesheets?
<link rel="stylesheet" href="a.css" title="a"/> <!--this works-->
<link rel="stylesheet" href="b.css" title="b"/> <!--this does not work-->
Upvotes: 2
Views: 147
Reputation: 78676
According to MDN - Correctly Using Titles With External Stylesheets
... A preferred stylesheet, on the other hand, is one that has a value of stylesheet supplied for the
rel
attribute, and any value at all for thetitle
attribute. Here are two examples:
<link type="text/css" rel="stylesheet" title="Basic styles" href="basic.css" />
<link type="text/css" rel="stylesheet" title="Fish and boats" href="ocean.css" />
According to the HTML 4.01 specification, only one of the preferred stylesheets can be used at a time. Therefore, given the above example, only one of the two preferred stylesheets will be applied to the document. The specification does not supply a procedure to decide which one should be used, so user agents are free to make whatever choice they like...
Upvotes: 2