Can we write the <legend>
tag twice in a <fieldset>
?
And can we include the <p>
tag inside the <fieldset>
?
<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>
Technically, 1 legend. Multiple p
s are ok. See the technical summary here and check out the link to 'Flow content'.
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." 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. And yes, it is fine to add p tags within fieldset. Take a look at the examples from the link I provided.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.