Dror Dror - 2 years ago 207
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 Source

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>.


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;


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download