gpt4 book ai didi

html - 为什么::selection:first-child 不起作用?

转载 作者:太空宇宙 更新时间:2023-11-03 20:32:02 25 4
gpt4 key购买 nike

为什么这段代码不起作用?

::selection:first-child{
background-color: #ffa563;
}

这很好用 - :first-child:last-child(当元素是第一个 child 和最后一个 child 时)

最佳答案

::selection 不是元素。尝试 :first-child::selection 应该可以。

:first-child::selection {
color: red;
}
<div>First Child</div>
<div>Second Child</div>

关于html - 为什么::selection:first-child 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39991955/

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