views:

52

answers:

1

I am attempting to target a <dt> only when followed by <dd>. I know there is a preceding selector, however I can not find a CSS method of targeting the <dt>. I know this is possible with JavaScript, but would rather keep it to CSS Selectors if at all possible.

This does not have to function in IE6 or below.

A: 

You want the sibling selector:

DT + DD { color : #00f; } 

Doesn't work in IE6 but does in other browsers.

furtive
This works the other way around. When DD is preceded by DT.
Michael Mior
Fine, then use DD + DT {color: #00f;} instead
furtive
That would target the DT, when preceded by DD. I am looking to target the DT when it is followed by a DD.
Eric Taylor