I have a checkbox
that I used in tables and other parts of my web application.
This checkbox is inside a DIV
so it has a nicer look and feel.
This is how the checkbox is formed in HTML
:
<div class="checkbox checkbox-success checkbox-single">
<input type="checkbox"><label></label>
</div>
I have detected that when I click in the center of the checkbox it works but If I checked like on the very top left, top right or bottom left it doesn't work.
Then I Inspect the element in Google chrome
and found this when I select the input
element.
That's why it not working because the input element is not centerd to the div.
I'm using Bootstrap 3.
Here are the CSS
that I can see in the Google chrome inspector when I select the input
element.
Here are the CSS
that I guess are applyed from my Style.css
.checkbox {
padding-left: 20px;
}
.checkbox label {
display: inline-block;
padding-left: 5px;
position: relative;
}
.checkbox label::before {
-o-transition: 0.3s ease-in-out;
-webkit-transition: 0.3s ease-in-out;
background-color: #ffffff;
border-radius: 3px;
border: 1px solid #cccccc;
content: "";
display: inline-block;
height: 17px;
left: 0;
margin-left: -20px;
position: absolute;
transition: 0.3s ease-in-out;
width: 17px;
outline: none !important;
}
.checkbox input[type="checkbox"] {
cursor: pointer;
opacity: 0;
z-index: 1;
outline: none !important;
}
.checkbox label::after {
color: #555555;
display: inline-block;
font-size: 11px;
height: 16px;
left: 0;
margin-left: -20px;
padding-left: 3px;
padding-top: 1px;
position: absolute;
top: 0;
width: 16px;
}
.checkbox.checkbox-single label {
height: 17px;
}
.checkbox-success input[type="checkbox"]:checked + label::before {
background-color: #01ba9a;
border-color: #01ba9a;
}
.checkbox-success input[type="checkbox"]:checked + label::after {
color: #ffffff;
}
This is breaking my head, any clue?
Aucun commentaire:
Enregistrer un commentaire