HTML and CSS Reference
In-Depth Information
</div>
<p>
<input type="checkbox" name="agree" id="agree">
<label for="agree">Do you agree to this site's Terms of
➥
Service?</label>
</p>
</fieldset>
Figure 11.7
Labels for radio
buttons and
check boxes.
Though using HTML tables for layout is outdated, taboo, and semanti-
cally incorrect, there are arrangements of forms that mimic a table. After
all, where is the form data headed most often but a database table or
series of tables? So if you have a series of inputs for multiple records
at one time or some similar scenario where you can have a one-to-one
relationship of data items to cells, marking up the elements as a series
of table cells and headers can be semantically appropriate.
Sets of conditional fields—if one option is chosen to display or enable
other options—typically have states managed by JavaScript, but each
state is defined via classes such as the
disabled
class used in the next
code block. The script would move the
disabled
class around as the form
elements are changed.
fieldset.disabled {
display: none;
(continues on next page)