HTML / CSS隐藏复选框
问题描述:
如何使用HTML / CSS隐藏复选框?
How can I hide a checkbox using HTML / CSS?
假设我有
<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>
复选框的名称和值不是恒定的。我知道jquery有某种方法,但是有没有办法用纯CSS或HTML隐藏它?
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?
答
.hidden {
display: none;
}
这将隐藏复选框(或任何具有 hidden类的HTML项)。该复选框仍以HTML格式存在,可以使用Javascript或通过开发人员的访问者启用/禁用。
This will hide the checkbox (or any HTML item with the class of "hidden") from display. The checkbox still exists in HTML and can be enabled/disabled with Javascript or by visitors with developer tools.