:nth-child()
奇数/偶数疑似クラスを定義リストに適用する方法がわかりません
<dl>
<dt>green foo</dt>
<dd>green bar</dd>
<dt>red foo</dt>
<dd>red bar</dd>
<dt>green foo</dt>
<dd>green bar</dd>
</dl>
<style>
dl { color: blue }
dd:nth-child(odd) { color:green }
dd:nth-child(even) { color:red }
</style>
新しいフィドル:
正しい :nth-of-type 疑似クラスで。
dd:nth-of-type(even) {color: red;}
dt:nth-of-type(even) {color: red;}
dd:nth-of-type(odd) {color: green;}
dt:nth-of-type(odd) {color: green;}
</p>