<label> </label>

PURPOSE: A tag to associate text labels with a specific element inside a form (such as an input element). This is done by having the values of the for attribute of the label tag and the id attribute of the form element be the same. **Note that you can attach more than one label to the same element.

Below is a basic html document. The referenced html tag is in RED. All tags must have a start and a end tag. Most end tags have a / before the tags name, however there are a few that are done differently. The tags that end differently will be noted and highlighted. The order of the start and end tags is also very important to proper display of your page in a web browser.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> The Page Title Goes Here </title>
</head>
<body>
<form>
<fieldset>
<legend>Enter Your Name</legend>
<label for="firstname">First Name</label><input type="text" id="firstname">
<br>
<label for="lastname">Last Name</label><input type="text" id="lastname">
</fieldset>
</form>
</body>
</html>


Here are the results of the code:

Enter Your Name

© Copyright 2001,2002 Southern Twilight    All rights reserved.

Back To HTML Examples