Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to style a radio button?

Tags:

html

css

I simply don't find any instructions how to style a radio button like the div in my example here: http://jsfiddle.net/Q5SRe/

The div:

div { 
    width:50px;
    height:50px;
    background-color:green
}

also I would like that when the radio button is selected it has:

border: medium solid #000;
like image 604
Em Sta Avatar asked Feb 18 '23 12:02

Em Sta


2 Answers

Radio buttons are part of the Shadow DOM, which as of yet can't be universally styled across browsers.

The best way currently to get custom radio buttons is to use images or the checkbox hack.

like image 72
jamesplease Avatar answered Feb 26 '23 17:02

jamesplease


I have used this before, it is not cross browser compatible and I would recommend you keep things simpler, but that depends on your personal choice and use case

like image 27
tim.baker Avatar answered Feb 26 '23 16:02

tim.baker