fieldset margin: 2em 0; : fieldset « Form « HTML / CSS






fieldset margin: 2em 0;

  


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

  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Example form</title>
    <style rel="stylesheet" type="text/css" media="screen">

fieldset {
    background-color:  #dfdfdf;
    border:  1px solid #ccc;
    margin:  2em 0;
    padding:  1em;
}


    </style>
  </head>
  
  <body>
    <form id="" action="" method="post">
      
      <fieldset id="name">
        <legend>Name</legend>
        <label>Title
          <select id="title1" name="title1">
            <option selected="selected">Mr.</option>
            <option>Mrs.</option>
            <option>Ms.</option>
          </select>
        </label>
        <label>First name
          <input id="first-name" name="first-name" type="text" />
        </label>
        <label>Last name
          <input id="las-name" name="last-name" type="text" />
        </label>
        <br />
      </fieldset>

      <fieldset id="address">
        <legend>Address</legend>
        <label>Street
          <input id="street" name="street" type="text" />
        </label>
        <br />
        <label>City
          <input id="city" name="city" type="text" />
        </label>
        <label>State
          <input id="state" name="state" type="text" />
        </label>
        <label>Zip code
          <input id="zip" name="zip" type="text" />
        </label>
        <br />
        <label>Country
          <input id="country" name="country" type="text" />
        </label>
        <br />
      </fieldset>

      <fieldset id="payment">
        <legend>Payment option</legend>
          <fieldset id="credit_card">
            <legend>Credit card</legend>
            <label><input id="visa" name="visa" type="radio" /> Visa</label>
            <label><input id="mastercard" name="mastercard" type="radio" /> Mastercard</label>
            <label><input id="discover" name="discover" type="radio" /> Discover</label>
            <br />
          </fieldset>
        <label>Card number
          <input id="card_number" name="card_number" type="text" />
        </label>
        <label>Expiration date
          <input id="expiration" name="expiration" type="text" />
        </label>
        <br />
        <input class="submit" type="submit" value="Submit" />
        <br />
      </fieldset>
      
    </form>
  </body>
  
</html>

   
  








Related examples in the same category

1.'fieldset' groups 'form' elements by drawing a rectangle
2.Fieldset and Legend Example
3.Form field set with legend
4.Style for form fieldset
5.Use fieldset to create a set of form controls
6.Fieldsets and labels
7.Set border for fieldset
8.borderless fieldsets
9.Set fieldset border to dashed style
10.Organizing Elements With fieldset and legend Elements
11.noframes for frameset
12.utf-8 charset page
13.nested fieldset background-color: #efefef;
14.fieldset padding: 1em;
15.fieldset border: 1px solid #ccc;
16.fieldset background-color: #dfdfdf;
17.fieldset margin-bottom: 1em;
18.fieldset border: 1px solid #888; border-right: 1px solid #666; border-bottom: 1px solid #666;
19.fieldset border: 3px solid rgb(234, 234, 234);
20.fieldset background: rgb(244, 244, 244);
21.Fieldset and Legend
22.Fieldset Background
23.Fieldset Alternating
24.fieldset font-size:12px; padding:10px; width:250px;text-align:right;
25.fieldset font-size:12px; padding:10px; width:250px; line-height:1.8;
26.Using legend for fieldset
27.>Organizing Elements With fieldset and legend Elements
28.The fieldset element
29.Removing the border from fieldsets
30.Nested Fieldset Example
31.fieldset border: 1px solid royalblue;
32.Element Subgroups