Remove a hover class from a checkbox once clicked

Posted by seangeraghty on Stack Overflow See other posts from Stack Overflow or by seangeraghty
Published on 2014-06-05T09:14:33Z Indexed on 2014/06/05 9:25 UTC
Read the original article Hit count: 562

Filed under:
|
|
|

I am trying to remove a hover class applied to a checkbox via CSS once the box has been clicked. Does anyone know how to do this?

JSFiddle http://jsfiddle.net/sa9fe/

The checkbox code is:

    <div>
     <input type="checkbox" id="checkbox-1-1" class="regular-checkbox flaticon-boxing3" />
     <input type="checkbox" id="checkbox-1-2" class="regular-checkbox" />
     <input type="checkbox" id="checkbox-1-3" class="regular-checkbox" />
     <input type="checkbox" id="checkbox-1-4" class="regular-checkbox" />
    </div>

And the CSS for the checkbox are as follows:

.regular-checkbox {
vertical-align: middle;
text-align: center;
margin-left: auto;
margin-right: auto;
align: center;
color: #39c;
width: 140px;
height: 140px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
background-color: #fff;
border: solid 1px #ccc;
-webkit-appearance: none;
background-color: #fff;
display: inline-block;
position: relative;}

.regular-checkbox:checked {
background-color: #39c;
color: #fff !important;}

.regular-checkbox:hover {
background-color: #f0f7f9;}

.regular-checkbox:checked:after {
color: #fff;
position: absolute;
top: 0px;
left: 3px;
color: #99a1a7; }

So any suggestions? Also does anyone know how to change the highlight because at the moment it seems to highlight the edges of the box at a border radius of 3px whereas the boxes I am using are 6px.

Thanks

Sean (newbie to coding)

© Stack Overflow or respective owner

Related posts about html

Related posts about css