gpt4 book ai didi

css - Asterisk 不会选择所有内容,至少不会选择 'moz-focus-inner'

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

这是我的 CSS:

* {
border: none;
}

现在,我认为星号意味着一切,显然它不适用于 ::-moz-focus-inner,这意味着我必须这样做:

* {
border: none;
}

*::-moz-focus-inner {
border: none;
}

这是为什么?

最佳答案

正如@Andrew Li 所说,通用的 * 选择器只选择元素。这是一个简单的元素选择器,仅针对页面上的实际元素。这是一个 related question在答案和评论中包含大量信息。

一个答案指向通用选择器 specification (强调我的):

The universal selector, written "*", matches the name of any element type. It matches any single element in the document tree.

最后一位排除了伪元素,如 ::-moz-focus-inner:before:after 不在文档树。


如果你想优化你的代码一点,你可以朝着这样的方向前进:

*,
*::-moz-focus-inner {
border: none;
}

关于css - Asterisk 不会选择所有内容,至少不会选择 'moz-focus-inner',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45553178/

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