【一句话】:first-child 伪类解释

关键词

不起作用 选不到 失败

解释

input:first-child 要求既是input元素,而且是兄弟节点中的第一个
如果要找第一个input元素,那么用input:first-of-type
如果要用 first-child 最好是用后代组合器组合一下

.box :first-child {...}

假设存在带box类的元素

注意 first-of-type 指的是标签,不是 class 暂时未实现 first-of-class

posted @ 2023-01-15 23:30  dou_fu_gan  阅读(67)  评论(0)    收藏  举报