CSS 伪类选择器 :has()
CSS About 210 words引入时间
Baseline 2023
优先级
:has()伪类的优先级计算方法与:is()和:not()相同。
语法
:has(相对选择器) {
/* ... */
}
示例
含义:h1后面紧挨着p,则将样式应用到h1上。
h1:has(+ p) {
margin-bottom: 0;
}
参考文档
Views: 14 · Posted: 2025-11-10
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...