I'm styling my input[type=radio]'s with CSS, because I need to replace the default radio with an image. Actually what I am doing is hide the input element, and show the styled label with the image background.
To do this I'm using new CSS3 selectors "#myinputradio + label" and "myinputradio:checked + label". All works well using the last versions of each browser (including IE9), but I need to get it working up to IE7.
I can also refer on JQuery, but I'd like to exploit the same CSS selector for JS and CSS3-ready browsers (I have a lot of radio inputs and each one has its own background image, placed from a common sprite).
Is there any way to do this supporting also older browsers?
Here a sample from HTML:
<input id="euro" type="radio" value="euro" checked="" name="currency">
<label for="euro"></label>
And here the CSS used to style it:
#euro + label /*and all other checkboxes*/ {
display: inline-block;
width: 37px;
height: 37px;
background: url(../img/sprites.png);
}
#euro + label {
background-position: 1042px 898px;
}
#euro:checked + label {
background-position: 1108px 898px;
}
If you need more informations, please ask me. Thanks.