HTML for attribute
for
The purpose of the HTML for attribute is to specify an identifier to the label element.
Supported elements
HTML for attribute supports label element.
Syntax
<label for="value" >.....</form>
Type of value
Identification reference.
Value
A piece of text.
Default value
There is no default value of HTML for attribute.
Supported doctypes
HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.
Example of HTML for attribute with label
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example of HTML for attribute with label</title>
</head>
<body>
<form action="action.php" method="post" enctype="text/plain">
<label for="first_name">First Name</label> : <input type="text" name="Fname" id="first_name"/><br/>
<label for="remarks" >Remarks</label> : <br/><textarea cols="10" rows="10" id="remarks"/> </textarea><br/>
<button type="button" name="Submit">Submit</button>
</form>
</body>
</html>
Result
View this example in a separate browser window
Example of HTML for attribute with label
Previous: HTML enctype attribute
Next: HTML frame attribute
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/html/attributes/html-for-attribute.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics