HTML Form Label Element

  • Post category:HTML
  • Post author:
  • Post last modified:June 14, 2021
  • Reading time:2 mins read
You are currently viewing HTML Form Label Element

The label element print a label for other form elements. It helps the user to enter the correct information in the right input field.

Label Element – Syntax

The label element start with <label> tag and closed with </label> tag.

<form>
<label>Enter your Name:</label>
<input type="text">
Other Form Elements..
</form>

Label Element – Attribute

The label element have attributes.

  • for – The label element for attribute represents for which element it prints a label. And the input elements have the same id attribute value. It binds them together.

Let see in the example

<form>
<label for="firstname">Enter your First Name:</label>
<input type="text" id="firstname">
Other Form Elements..
</form>

Ashim Khatua

Professionally Web Developer since 2015, And also a Blogger. I am the founder of SiteCodings.com. I love to share my knowledge, which I earned the past few years. I want to share my knowledge with you through my Blog. Keep Reading.

Leave a Reply