HTML tags inside lt;labelgt;(lt;labelgt; 中的 HTML 标签)
问题描述
我在页面中有一个表格,其中包含左侧单元格中的复选框和右侧单元格中的说明.描述"包含 h4 标题和纯文本.我想将整个描述(<td></td>
中的所有内容)都作为标签.
I have a table in a page that consists of checkboxes in the cells on the left and descriptions in the cells on the right. The "description" contains h4 headers and plain text. I want to make that whole description (everything inside <td></td>
) a label.
所以每一行看起来像这样:
So each row looks like this:
<tr><td><input type="checkbox" name="entiries[]" value="i1" id="i1"></td>
<td><label for="i1">
<h4>Some stuff</h4>more stuff..
<h4>Some stuff</h4>more stuff..
</label>
</td></tr>
但是,这不起作用,文本不像标签并且不可点击.我正在使用 Firefox 3.6 来测试它.如果我删除 <h4>
标记它开始工作,但这会使格式复杂化.<h*>
标签是否有某些东西会阻止 <label>
正常工作?
This does not work however, the text does not act like a label and is not clickable. I'm using Firefox 3.6 to test it. If I remove <h4>
tags it starts working, but that complicates formatting. Is there something about <h*>
tags that prevents <label>
from working correctly?
推荐答案
块级元素(h4
所属的)不允许在内联元素中,并且会导致未定义的行为.您可以改用 span
元素.
Block level elements (to which h4
belongs) are not allowed inside inline elements, and will cause undefined behaviour. You can use span
elements instead.
这篇关于<label> 中的 HTML 标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:<label> 中的 HTML 标签


基础教程推荐
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01
- 动态更新多个选择框 2022-01-01
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06
- 在for循环中使用setTimeout 2022-01-01
- 我什么时候应该在导入时使用方括号 2022-01-01
- 悬停时滑动输入并停留几秒钟 2022-01-01
- 响应更改 div 大小保持纵横比 2022-01-01