gpt4 book ai didi

html - 标题属性导致样式表停止工作

转载 作者:行者123 更新时间:2023-11-28 15:47:36 25 4
gpt4 key购买 nike

我目前正在试验 CSS 对象模型,并试图了解 StyleSheet 的所有属性和方法是如何实现的。 , CSSStyleSheet , CSSRule所有这类对象都有效。我不知道为什么,如果我添加 title我的 <link rel="stylesheet"> 的属性元素导致“关闭”特定样式表,而 disabled属性仍设置为 false对于所有样式表?

<link rel="stylesheet" href="a.css" title="a"/>  <!--this works-->
<link rel="stylesheet" href="b.css" title="b"/> <!--this does not work-->

最佳答案

根据 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 the title 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...

关于html - 标题属性导致样式表停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42463050/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com