css - 如何跳过第一个 child ?

标签 css css-selectors

<div id="main">    
  <p> one </p>    
  <p> two </p>
  <p> three </p>
  <p> four </p>
  <p> five </p>
<div>

我不想首先应用 css <p>One</p>

p {color:red}

我需要 :first-child 的对面.

最佳答案

the negation pseudo-class :

p:not(:first-child) { color: red; }

浏览器支持是 very strong现在,但替代方案包括:

p { color: red; }
p:first-child { color: black; }

和:

* + p { color: red; }

关于css - 如何跳过第一个 child ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2855679/

相关文章:

javascript - 通过 GET URL 加载 Bootstrap nav nav-tabs

javascript - 循环动画不起作用

html - CSS选择第一个没有类的元素

selenium - InvalidSelectorException 使用 CSS 选择器定位 "data-"属性标记的元素

python - CSS Selector 获取元素属性值

python - CSS 或 xpath :select the first 2 elements

html - 在另一个之上显示一个 div

用于根据文本获取 Web 元素的 Css 选择器

css - CSS3的:root pseudo class and html?有什么区别

jquery - 两个div的高度相等