Form With Label

An HTML form using the label tag.


<form action="PHP-Form-Action.php">
  <label for="favColor">Favorite color: </label>
  <input type="text" id="favColor" name="favColor">

  <label for="favFood">Favorite Food: </label>
  <input type="text" id="favFood" name="favFood">

  <input type="submit" value="Submit">


Notice, clicking on the words "Favorite color", or "Favorite food" will put focus in the text input box.

To align the input boxes, make the label the same width, i.e. <label style="display:inline-block;width:160px" for ...

Enter the info and click submit. (This only submits to a div below) The point of this page is to show how to use the label with form input.


Copyright © Website Development | Disclaimer | Privacy Policy | Terms of Use