Possible Duplicate:
CSS previous sibling selector
Is there any way to format an element based on its successor? Example:
<label for="myelement">My Label</label>
<input type="text" name="test" id="myelement" />
<label for="different">Another Label</label>
<input type="radio" name="anothertest" id="different" value="yes" />
Now I'm formatting label
with CSS like this:
label { display: block; }
It's obvious now, that this affects the styling of all label
elements. But I'd like to avoid this when an input
element of type=radio
is following the label
. Is there any way to achieve this in CSS without using any class
or id
element?