Organizing Elements With fieldset and legend Elements : legend « Form « HTML / CSS






Organizing Elements With fieldset and legend Elements

  
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
  <title>Organizing Elements With &lt;fieldset&gt; and &lt;legend&gt;Elements</title>
</head>

<body>
<form action="" method="post" name="frmComp">
  <fieldset>
    <legend><em>Contact Information</em></legend>
      <label>First name: <input type="text" name="txtFName" size="20" /></label><br />
      <label>Last name: <input type="text" name="txtLName" size="20" /></label><br />
      <label>E-mail: <input type="text" name="txtEmail" size="20" /></label><br />
  </fieldset>
  <fieldset>
      <legend><em>Competition Question</em></legend>
  </fieldset>
  <fieldset>
    <legend><em>Question</em></legend>
      <label>say why you would like to win $10,000: <br />
        <textarea name="txtTiebreaker" rows="10" cols="40"></textarea>
      </label>
  </fieldset>
  <fieldset>
    <legend><em>Enter competition</em></legend>
       <input type="submit" value="Enter Competition" />
  </fieldset>
</form>
</body>
</html>

   
  








Related examples in the same category

1.The legend element
2.Style for form legend
3.Set style for legend
4.form legend style
5.Set font, color, background color and text-transform for legend tag
6.legend top: -.4em;
7.legend position: relative;
8.legend font-size: 1.4em;
9.legend font-weight: bold;
10.Set form access key
11.legend border: 1px solid #888; border-right: 1px solid #666; border-bottom: 1px solid #666;
12.legend padding: .5em;
13.legend background-color: #CCC;
14.legend background: gold;
15.legend border: 1px solid rgb(75, 75, 75);
16.legend color: rgb(75, 75, 75);