html - CSS3 radio button not working in Firefox -
i'm trying style radio button using css3 pseudo elements. in works great in chrome jumps default styling in firefox. idea?
here's fiddle: jsfiddle
the html:
<input class="fancy" name="cc1" type="radio" checked/> <input class="fancy" name="cc1" type="radio"/>
the css:
input[type="radio"].fancy:before { content:""; width: 24px; height: 24px; background-color: #1f1f1f; display: block; border-radius: 50%; position: relative; top: -6px; left: -6px; box-shadow: 0 1px 2px rgba(255,255,255,.1), inset 0 2px 2px rgba(0,0,0,.8); } input[type="radio"].fancy:checked:before { visibility: visible; content:""; width: 24px; height: 24px; background-color: #1f1f1f; display: block; border-radius: 50%; position: relative; top: -6px; left: -6px; box-shadow: 0 1px 2px rgba(255,255,255,.2), inset 0 2px 2px rgba(0,0,0,.8); } input[type="radio"].fancy:checked:after { visibility: visible; content:""; width: 14px; height: 14px; display: block; border-radius: 50%; position: relative; top: -25px; left: -1px; background: yellowgreen; }
i'm trying avoid background-images
unfortunately, you're trying not valid -- ::before
, ::after
not work on input
elements (any input
; it's not restricted radio buttons).
proof available here: http://jsfiddle.net/lvae2/1/ -- in simple case, doesn't work.
it doesn't work in ie or opera. fact work in chrome because chrome going beyond spec in allowing it.
your best bet styling on label
element linked actual radio button using for
attribute, , set radio button display:none;
. how else it.
related question here: which elements support ::before , ::after pseudo-elements?
hope helps.
Comments
Post a Comment