Supposing I have a HTML like this
<label><input type="radio" checked></label>
<label><input type="radio"></label>
Question: how can I select the label of a checked radio in this case?
Supposing I have a HTML like this
<label><input type="radio" checked></label>
<label><input type="radio"></label>
Question: how can I select the label of a checked radio in this case?
What you are trying to achieve is not possible in CSS3.. if you want, you can wrap the elements inside a container, and position them either by floating, or by using position: absolute;
Demo (Not relevant as you've not provided any specific code, but I've shared a general example here)
div.wrap label {
float: left;
}
.wrap input[type=radio]:checked + label {
color: red;
}
In CSS3, there's currently no way to do that.
What you should do is add a class to your label
s, then target that class.
For reference, they're looking to include this in the CSS 4 Specification which would use the notation:
!label > input[type="radio"]:only-child
But that's not supported by any browsers yet (as it isn't even finalised).