所以基本上我做了这种情况,父级有cssall: unset
.
然后我注意到当我使用 Safari(版本12.1.1 (14607.2.6.1.1)
)它的所有子颜色只能受到以下影响*
块,甚至不是内联或!important
.
但只有color
行为方式就是这样,正如你所看到的background-color
正在使用自己的财产。
但它在 Chrome 中运行良好,是 safari 中的故障还是我做错了什么?我该如何在 Safari 中修复它?
* {
color: red; /* Text color is using this one */
background-color: pink;
}
.Parent {
all: unset;
}
.Child {
color: blue;
background-color: yellow; /* Background color is using this one */
}
<div class="Parent">
<div class="Child">Some Text</div>
</div>
Safari 使用特殊属性-webkit-text-fill-color。如果你使用它,颜色就会起作用:
* {
color: red; /* Text color is using this one */
background-color: pink;
-webkit-text-fill-color: red;
}
.Parent {
all: unset;
}
.Child {
color: blue;
background-color: yellow; /* Background color is using this one */
-webkit-text-fill-color: blue;
}
<div class="Parent">
<div class="Child">Some Text</div>
</div>
@丹·法布里奇下面评论了这个错误:
https://bugs.webkit.org/show_bug.cgi?id=158782
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)