1

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?

Community
  • 1
  • 1
Damien
  • 11
  • 1

1 Answers1

0

No, there is no way. css only allows you to select based on the predecessor using +

kritzikratzi
  • 19,662
  • 1
  • 29
  • 40