html - 隐藏标签

标签 html css input label

我想禁用或隐藏内容“分组” 的 <label>标记而不影响嵌套 <input>标签。

<label class="" for="officersheet_fields_attributes_3_grouping">
<input type="checkbox" id="officersheet_fields_attributes_3_grouping" name="officersheet[fields_attributes][3][grouping]" value="1">
Grouping
</label>`

我在 Rails 中使用 formtastic。 formtastic 代码片段 <td><%= f.input :grouping %></td>

上面的行生成上面的 html。

提前致谢

最佳答案

您可以使用text-indent: -1000em

label
{
    text-indent: -1000em;
}

但我不认为将输入放在标签内是个好主意。最好有以下内容:

<input type="checkbox"/><label>Grouping</label>

关于html - 隐藏标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15357198/

相关文章:

html - 使用 div 创建垂直条

javascript - document.getElementById onclick 也触发功能 2/表单 2

javascript - 在 Canvas 上绘制纬度/经度坐标

css - 用户滚动时标题变为固定

html - Bootstrap 列包装在移动设备上,应该完全适合内联

c++ - 是否可以在 CEdit 控件的纯数字输入模式和字母数字输入模式之间切换?

python - 如何在 Python 中输入矩阵(二维列表)?

javascript - AngularJS ng-click 在点击时显示值

css - 在 Bootstrap 4 中使用容器宽度

html - 如何阻止文本区域在两个不同版本的 chrome 上看起来不同?