Element Subgroups : fieldset « Form « HTML / CSS






Element Subgroups

 
<!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>
  <title>Element Subgroups</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <style type="text/css" media="screen">
fieldset
{
  float: left;
  clear: left;
  width: 100%;
  margin: 0 0 1.5em 0;
  padding: 0;
  border: 1px solid #BFBAB0;
  background-color: #F2EFE9;
  background-repeat: repeat-x;
}

legend
{
  margin-left: 1em;
  padding: 0;
  color: #000000;
  font-weight: bold;
}

fieldset ol
{
  padding: 1em 1em 0 1em;
  list-style: none;
  zoom: 1;
}

fieldset li
{
  float: left;
  clear: left;
  width: 100%;
  padding-bottom: 1em;
}

label
{
  float: left;
  width: 10em;
  margin-right: 1em;
}

fieldset fieldset
{
  margin-bottom: -2.5em;
  border-style: none;
  background-color: transparent;
  background-image: none;
}

fieldset fieldset legend
{
  margin-left: 0;
  font-weight: normal;
}

fieldset fieldset ol
{
  position: relative;
  top: -1.5em;
  margin: 0 0 0 11em;
  padding: 0;
}

fieldset fieldset label
{
  float: none;
  width: auto;
  margin-right: auto;
}

fieldset.submit
{
  float: none;
  width: auto;
  border-style: none;
  padding-left: 12em;
  background-color: transparent;
  background-image: none;
}  </style>
</head>
<body>
  <div id="page">
    <div id="header">
      <h1>
        Element Subgroups
      </h1>
    </div> <!-- END #header -->
    <div id="content">
      <p>
        Fill in your details below.
      </p>
      <form action="example.php">
        <fieldset>
          <legend>
            Contact Details
          </legend>
          <ol>
            <li>
              <label for="name">
                Name:
              </label>
              <input id="name" name="name" class="text" type="text" />
            </li>
            <li>
              <fieldset>
                <legend>
                  Occupation:
                </legend>
                <ol>
                  <li>
                    <input id="occupation1" name="occupation1" class="checkbox" type="checkbox" value="1" />
                    <label for="occupation1">
                      Doctor
                    </label>
                  </li>
                  <li>
                    <input id="occupation2" name="occupation2" class="checkbox" type="checkbox" value="1" />
                    <label for="occupation2">
                      Lawyer
                    </label>
                  </li>
                  <li>
                    <input id="occupation3" name="occupation3" class="checkbox" type="checkbox" value="1" />
                    <label for="occupation3">
                      Teacher
                    </label>
                  </li>
                  <li>
                    <input id="occupation4" name="occupation4" class="checkbox" type="checkbox" value="1" />
                    <label for="occupation4">
                      Web designer
                    </label>
                  </li>
                </ol>
              </fieldset>
            </li>
            <li>
              <label for="phone">
                Telephone:
              </label>
              <input id="phone" name="phone" class="text" type="text" />
            </li>
          </ol>
        </fieldset>
        <fieldset class="alt">
          <legend>
            Delivery Address
          </legend>
          <ol>
            <li>
              <label for="postcode">
                Postcode:
              </label>
              <input id="postcode" name="postcode" class="text textSmall" type="text" />
            </li>
            <li>
              <fieldset>
                <legend>
                  Country:
                </legend>
                <ol>
                  <li>
                    <input id="country1" name="country" class="radio" type="radio" value="1" />
                    <label for="country1">
                      Doctor
                    </label>
                  </li>
                  <li>
                    <input id="country2" name="country" class="radio" type="radio" value="2" />
                    <label for="country2">
                      Lawyer
                    </label>
                  </li>
                  <li>
                    <input id="country3" name="country" class="radio" type="radio" value="3" />
                    <label for="country3">
                      Teacher
                    </label>
                  </li>
                  <li>
                    <input id="country4" name="country" class="radio" type="radio" value="4" />
                    <label for="country4">
                      Web designer
                    </label>
                  </li>
                </ol>
              </fieldset>
            </li>
          </ol>
        </fieldset>
        <fieldset class="submit">
          <input class="submit" type="submit" value="Begin download" />
        </fieldset>
      </form>
    </div><!-- END #content -->
  </div> <!-- END #page -->
</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 margin: 2em 0;
16.fieldset border: 1px solid #ccc;
17.fieldset background-color: #dfdfdf;
18.fieldset margin-bottom: 1em;
19.fieldset border: 1px solid #888; border-right: 1px solid #666; border-bottom: 1px solid #666;
20.fieldset border: 3px solid rgb(234, 234, 234);
21.fieldset background: rgb(244, 244, 244);
22.Fieldset and Legend
23.Fieldset Background
24.Fieldset Alternating
25.fieldset font-size:12px; padding:10px; width:250px;text-align:right;
26.fieldset font-size:12px; padding:10px; width:250px; line-height:1.8;
27.Using legend for fieldset
28.>Organizing Elements With fieldset and legend Elements
29.The fieldset element
30.Removing the border from fieldsets
31.Nested Fieldset Example
32.fieldset border: 1px solid royalblue;