css选择第一个子元素或者非第一个子元素有哪些方法实现
如果我们要获取到ul标签下面的第一个li标签来设置样式,有哪些css方法来实现呢?一 、获取第一个元素1. 使用 :first-childul li:first-child { ......}2. 使用 :first-of-typeul li:first-of-type { ......}3. 使用 :nth-childul li:nth-child(1){......}4. 使用 :nth-of-typeul li:nth-of-type(1){......}
原创
2021-03-05 13:46:19 ·
16935 阅读 ·
0 评论