How can I hide a checkbox using HTML / CSS?
Let's say I have
<table>
<thead>
<th>
Col A
</th>
<th>
Col B
</th>
</thead>
<tbody>
<tr>
<td> <input type="checkbox" class="hidden"> Some stuff </td>
</tr>
<tr>
<td> Some Other stuff </td>
</tr>
</tbody>
</table>
The name and the values of the checkbox are not constant. I know there's some way with jquery but is there a way to hide it with pure CSS or HTML?
Wrap the entirety with a label which will then allow you to use style="display:none to hide the label . You also used status instead of style but by using the code above you'll do fine.
The disabled property sets or returns whether a checkbox should be disabled, or not. A disabled element is unusable and un-clickable. Disabled elements are usually rendered in gray by default in browsers. This property reflects the HTML disabled attribute.
Please keep in mind that setting the display property to none, makes the element inaccessible using tabs (see: Checkbox tab index not working when set to hidden with custom design). If you case about accessibility, you can use:
input[type=checkbox].hidden{
opacity: 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With