I've created a small looking button to display instead of a checkbox. I was wondering if there was a way to also have a :hover look somehow? thanks
http://jsfiddle.net/zAFND/2/
It is possible to style a checkbox using Pseudo Elements like :before, :after, hover and :checked. To style the checkbox the user first needs to hide the default checkbox which can be done by setting the value of the visibility property to hidden. Example 1: Consider the example where HTML checkbox is styled using CSS.
By default, browsers have their own UI style, but you can use CSS to style the checkbox and create a unique look for your website or app.
Alternatively referred to as mouseover or mouse hover, hover describes the act of moving a mouse pointer over a clickable object, but not actually clicking the left or right mouse button. For example, when you hover your mouse over any of the links on this page, they should change color, indicating they can be clicked.
#ck-button:hover { background:red; }
Fiddle: http://jsfiddle.net/zAFND/4/
it looks like you need a rule very similar to your checked rule
http://jsfiddle.net/VWBN4/3
#ck-button input:hover + span { background-color:#191; color:#fff; }
and for hover and clicked state:
#ck-button input:checked:hover + span { background-color:#c11; color:#fff; }
the order is important though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With