Example 5 - Text input control label references form control id

Example Start

Example End

Example Description

Example Features

Related Rules

HTML Source Code


<div class="text">
    <label for="name">Name</label>
    <input type="text" size="30" name="name" id="name"/>
</div>

<div class="text">
    <label for="email">E-mail</label>
    <input type="text" size="25" name="email" id="email"/>
</div>

<div class="text">
    <label for="comment">Comment</label>
    <textarea rows="5" cols="50" name="comment" id="comment"></textarea>
</div>

CSS Code


div.text label {
  margin: 0;
  padding: 0;
  margin-left: 20px;
  display: block;
  font-size: 100%;
}

div.text input,
div.text textarea {
  margin: 0;
  padding: 0;
  margin-left: 20px;
  margin-bottom: 1.25em;
  display: block;
}