gpt4 book ai didi

CSS 2,使用链接元素导入的样式表的优先级

转载 作者:行者123 更新时间:2023-11-28 09:00:15 26 4
gpt4 key购买 nike

给定

<link rel="STYLESHEET" href="/css/t.cake.css" type="text/css"/>
<link rel="STYLESHEET" href="/css/f.css" type="text/css"/>
<link rel="STYLESHEET" href="/css/t.generic.css" type="text/css"/>
<link rel="STYLESHEET" href="/css/t.head.css" type="text/css"/>

哪些规则在级联中具有更高的优先级?假设所有人都具有与其他 CSS 比较相同的优先级?那些在第一个或最后一个样式表中?

TIA 戴夫普

最佳答案

根据 the specs , 应用最新的。

4. Finally, sort by order specified: if two declarations have the same weight, origin and specificity, the latter specified wins. Declarations in imported style sheets are considered to be before any declarations in the style sheet itself.

无论如何,单独依赖它并不是好的做法,因为它会使您的代码难以阅读和解释。我会确保通过 specificity 应用了正确的规则选择器的选择器,无论它们放在什么样式表中。

关于CSS 2,使用链接元素导入的样式表的优先级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/964328/

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