HTML - Legend

About

legend is an element that represents a caption for the fieldset element.

Example

Example of a legend with a checkbox that controls whether or not the fieldset is enabled

<form>
<fieldset name="clubfields" disabled>
 <legend> <label>
  <input type=checkbox name=club onchange="form.clubfields.disabled = !checked">
  Use Club Card
 </label> </legend>
 <p><label>Name on card: <input name=clubname required></label></p>
 <p><label>Card number: <input name=clubnum required pattern="[-0-9]+"></label></p>
 <p><label>Expiry date: <input name=clubexp type=month></label></p>
</fieldset>
</form>

Documentation / Reference





Discover More
HTML - FieldSet element

fieldSet is an HTML element that groups element in a form A fieldset: may have a legend can also be nested ( fieldset inside fieldset) ...



Share this page:
Follow us:
Task Runner