w3schools    w3Schools
Search :
   
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About
ADVERTISEMENTS

XML Certification
Download XML editor
Custom Programming
 
Table of contents
HTML Reference
HTML by Alphabet
HTML by Function
HTML Attributes
HTML Events
HTML Colornames
HTML Character Sets
HTML ASCII
HTML ISO-8859-1
HTML Symbols
HTML URL Encode
HTML Lang Codes
HTTP Messages

HTML Tags
<!-->
<!DOCTYPE>
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<b>
<base>
<basefont>
<bdo>
<big>
<blockquote>
<body>
<br>
<button>
<caption>
<center>
<cite>
<code>
<col>
<colgroup>
<dd>
<del>
<dfn>
<dir>
<div>
<dl>
<dt>
<em>
<fieldset>
<font>
<form>
<frame>
<frameset>
<head>
<h1> - <h6>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<label>
<legend>
<li>
<link>
<map>
<menu>
<meta>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<p>
<param>
<pre>
<q>
<s>
<samp>
<script>
<select>
<small>
<span>
<strike>
<strong>
<style>
<sub>
<sup>
<table>
<tbody>
<td>
<textarea>
<tfoot>
<th>
<thead>
<title>
<tr>
<tt>
<u>
<ul>
<var>

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

Browse Tutorials
 

HTML label for Attribute


HTML label Tag Reference HTML <label> tag

Definition and Usage

The align attribute specifies the the form element the label is assigned to.

The other way of assigning a label to a for element is to wrap the <label> tags around the form element.

However, using the for attribute is more widely supported and recommended.

Syntax

<label for="id">

Syntax Example

<label for="text1">

Attribute Values

Value Description
id Specifies the id of the element the label is bound to. Must be an existing form element.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The attribute is supported in all major browsers.


Example

<form action="">
<label for="text1">Name:</label>
<input type="text" id="text1" />
</form>


Try-It-Yourself Demos

label for attribute example
Specify which element the label is bound to.


HTML label Tag Reference HTML <label> tag