Dror Dror - 7 months ago 61
HTML Question

Styling checkbox without a label

I tried this tutorial to create a checkbox with a different style.

This checkbox has a label. When I delete the label it (or the text in it) the checkbox doesn't shown.

How can I see the checkbox without having a text?

Answer

In the CSS you can see everywhere input[type=checkbox]:not(old):checked + label, so if you remove label, CSS will not be used. So either change your CSS, or leave label empty - <label for="XYZ"></label>.

EDIT

So just add min-width and height property:

input[type=checkbox]:not(old) + label,
input[type=radio   ]:not(old) + label{
  height: 45px;
  min-width: 45px;
}

DEMO