Bst*_*der 2 html css css-selectors css3
给出下面的示例,每行需要有三个文本列,即三个句子,其中中间的列也需要有一个background-color.是否可以使用nth-child() 选择器执行此操作?
p {
display: inline-block;
width: 30%;
}
p:nth-child(2n+0) {
background: red;
}Run Code Online (Sandbox Code Playgroud)
<p>The first paragraph.</p>
<p>The second paragraph.</p>
<p>The third paragraph.</p>
<p>The fourth paragraph.</p>
<p>The fifth paragraph.</p>
<p>The sixth paragraph.</p>
<p>The seventh paragraph.</p>
<p>The eight paragraph.</p>
<p>The ninth paragraph.</p>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
274 次 |
| 最近记录: |