
I am using code inspired by the CSS Wizardy entry about styling radio and checkboxes by setting their opacity to zero, and putting something on top of it. I have some html like this <input type="radio" name="attr_show-SPM-details" class="sheet-hideIfThisChecked sheet-show-all" value="3" checked title="Show All." />
<span class="sheet-option"></span>
and some css like this. .sheet-show-all,
.sheet-show-most,
.sheet-hide-all {
opacity: 0;
width: 5em;
height: 100%;
position: relative;
vertical-align: middle;
margin-right: -5em;
cursor: pointer;
z-index: 1;
}
input[type="checkbox"]+.sheet-option-show::before,
input[type="radio"]+.sheet-option::before {
margin-right: 4px;
line-height: 24px;
text-align: center;
display: inline-block;
vertical-align: middle;
width: 5em;
height: 24px;
font-size: 12px;
}
.sheet-show-all+.sheet-option::before {
content: "[show all]";
}
So basically what I end up with is a display of [show all] that is 5 em wide, and under it, I get a 5em wide checkbox. Check the text, and the checkbox fires. The only problem is that if this combo happens to appear right at the end of a row, the ::before text will flow down to be the start of the next row, but the invisible checkbox will stay at the end of the previous row. If I inspect the values, Chrome shows the checkbox after the last element and hanging off outside of the display area it is supposed to be in. I am not so good with css and the box model, but it seems to me that the ::before text shifted down to the next row as one would expect it to, while for some reason the invisible checkbox is exceeding it's allocated area. I assume they have some different sorts of options that I have to set them to be the same, but it does not seem to be "overflow" and I don't know what other option it could be. Any help would be greatly appreciated.