[英]Can we write Legend tag twice inside a fieldset tag?
Can we write the <legend>
tag twice in a <fieldset>
?我们可以在
<fieldset>
中写两次<legend>
标签吗?
And can we include the <p>
tag inside the <fieldset>
?我们可以在
<fieldset>
中包含<p>
标签吗?
<fieldset>
<legend>Feedback</legend>
<p>Did you like it?</p>
<input type="checkbox" name="level" value="low" />
<label for="level">I didn't Like it.</label>
<input type="checkbox" name="level" value="high" />
<label for="level">Heck, Yes.</label>
<legend>Subscribe for newsletter:</legend>
<input type="radio" name="newsletter" value="yes">
<label for="newsletter">Yes</label>
<input type="radio" name="newsletter" value="no">
<label for="newsletter">No</label>
</fieldset>
Per the W3 specification: "The name of the group is given by the first legend element that is a child of the fieldset element, if any. The remainder of the descendants form the group."根据 W3 规范: “组的名称由作为 fieldset 元素的子元素的第一个图例元素(如果有的话)给出。其余的后代形成组。” There is no indication that having multiple legend tags present would be invalid HTML, but I don't think it is a good idea to have more than one.
没有迹象表明存在多个图例标签会无效 HTML,但我认为拥有多个图例标签不是一个好主意。 And yes, it is fine to add p tags within fieldset.
是的,可以在字段集中添加 p 标签。 Take a look at the examples from the link I provided.
查看我提供的链接中的示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.