< label>标签内的HTML标签 [英] HTML tags inside <label>
问题描述
我在页面中有一个表格,其中包含左侧单元格中的复选框和右侧单元格中的描述。 描述包含h4标题和纯文本。我想将整个描述(< td>< / td>
内的所有内容)作为标签。
所以每一行都是这样的:
< tr>< td>< input type =checkboxname = entiries []value =i1id =i1>< / td>
< td>< label for =i1>
< h4>一些东西< / h4>更多东西..
< h4>一些东西< / h4>更多东西..
< / label>
< / td>< / tr>
然而,这并不起作用,文本不会像标签一样工作,也不可点击。我使用Firefox 3.6来测试它。如果我删除< h4>
标签,它会开始工作,但这会使格式变得复杂。是否有一些关于防止< label>
无法正常工作的< h *>
标签?
块级元素( h4
所属)不允许嵌入元素,并会导致未定义的行为。您可以使用 span
元素。
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>
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?
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标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!