I have found a few posts related to this subject, but no answers seem to be working in my scenario, I am assuming due to my custom class for the checkbox.
Essentially I just want the text next to the checkbox to always vertically align with it, but the vertical alignment behavior is different based on whether the checkbox is checked or not.
I have made the font-size
, height
, and line-height
equivalent for the text and checkbox, which seems to not have made a difference. I have also tried content: "\200b";
in the css but that also seems to not make a difference.
Also, I am unable to use "newer" html/css things because this is for an application that uses an older version of html/css before flexbox.
.lvl1Name {
line-height: 22px;
height: 22px;
font-size: 22px;
}
.checkboxBig {
-webkit-appearance: none;
width: 22px;
line-height: 22px;
height: 22px;
font-size: 22px;
background: white;
border-radius: 0px;
border: 2px solid #144b68;
line-height: 10px;
padding-left: 1px;
text-align: center;
}
.checkboxBig:hover {
background: #80AED1;
}
.checkboxBig:checked {
background: #DAE5EB;
}
.checkboxBig:checked:after {
content: "\2713";
font-size: 22px;
padding-left: 1px;
text-align: center;
color: #144b68;
line-height: 22px;
}
.checkboxBig:checked:hover {
background: #80AED1;
}
<div>
<input class="checkboxBig" type="checkbox">
<span class="lvl1Name">Testing</span>
</div>