HTML Label Element

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • <label>Example <input type="radio" name="r"></label> // Wrapping a control Element
  • <label for="rad1">Example</label> <input id="rad1" type="radio" name="r"> // Using for attribute

Parameters

AttributesDescription
forReference to the target ID Element. I.e: for="surname"
formHTML5, [Obsolete] Reference to the form containing the Target Element. Label elements are expected within a <form> Element. If the form="someFormId" is provided this allows you to place the Label anywhere in the document.


Got any HTML Question?