HTML / CSS隐藏复选框 [英] HTML / CSS hide checkbox

查看:350
本文介绍了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.

这篇关于HTML / CSS隐藏复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆