我想仅将效果应用于标记元素'p'。但我有一个阻止效果的div!第二段必须是蓝色的,怎么办?:nth-child()选择器应用于特定元素
<p>The first paragraph.</p>
<div>The div tag.</div>
<p>The second paragraph.</p>
<p>The third paragraph.</p>
<p><b>Note:</b> Internet Explorer 8 and earlier versions do not support the :nth-child() selector.</p>
p:nth-child(odd) { background: #ff0000; }
p:nth-child(even) { background: #0000ff; }
ahahha不错不错...很简单,呵呵 –