css - 我可以使用多 css 伪选择器类吗?

标签 css css-selectors

好的,有没有可能使用多个伪选择器类?

我有一个列表,我需要为其中的两个列表元素添加一些样式。

好像是:

li:nth-child(2+4) or li:nth-child(2,4) or li:nth-child(2|4)?

最佳答案

欧简单

li:nth-child(2), li:nth-child(4) {}

关于css - 我可以使用多 css 伪选择器类吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8007848/

相关文章:

html - 将 div 直接放在父 div 之上

css - 如何减去元素样式已经定义的高度的大小?

php - 在 echo 中格式化日期

javascript - 字符串到数组,然后选中复选框

css - ".class"和 ".class, .class .class"之间的区别?

html - div 中的图像在图像下方有额外的空间

css - 选择父元素中 3 的倍数的元素

CSS3第n个子瓦片背景颜色根据列数交替

css - 将非 CSS 选择器与相邻选择器组合

css - 在 * 上应用 "reset"样式