Example 10 - Required text boxes using hidden text

Example Start

required imemail Indicates required fields.

Example End

Example Description

Example Features

Related Rules

HTML Source Code


<div class="inst">
    <img src="http://webaccessibility.cita.illinois.edu/media/examples/images/asterisk-blue.png" alt="required imemail"/> Indicates required fields.
</div>

<div class="text">
    <label for="name">Name <span class="offscreen">required</span></label>
    <div><input type="text" size="30" name="name" id="name"/><img src="http://webaccessibility.cita.illinois.edu/media/examples/images/asterisk-blue.png" alt=""/></div>
</div>

<div class="text">
    <label for="email">E-mail <span class="offscreen">required</span></label>
    <div><input type="text" size="25" name="email" id="email"/><img src="http://webaccessibility.cita.illinois.edu/media/examples/images/asterisk-blue.png" alt=""/></div>
</div>

<div class="text">
    <label for="comment">Comment <span class="offscreen">required</span> <img src="http://webaccessibility.cita.illinois.edu/media/examples/images/asterisk-blue.png" alt=""/></label>
    <textarea rows="5" cols="50" id="comment" name="comment"></textarea>
</div>

CSS Code



span.offscreen  {
  position: absolute;
  top: -20em;
  left: -300em;
}


div.inst {
  margin: 0;
  padding: 0;
  margin-left: 20px;
  margin-bottom: 1em;
}

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: .5em;
  font-size: 100%;
}

div.text img {
  margin: 0;
  padding: 0;
  padding-left: .25em;
}

input:active,
input:focus,
input:hover,
textarea:active,
textarea:focus,
textarea:hover {
  background-color: lightyellow;
  border-color: yellow;
}