Adding Check Boxes and Radio Buttons

Check boxes are an excellent way to get information from a site visitor from a preset selection of choices. The advantage of check boxes is that visitors can select from more than one option, and that's the best time to use them—when the possibility of multiple answers exists. To create check boxes, you use the input element along with the type attribute and a value of checkbox (see Example 5-5).

Example 5-5. Adding check boxes to the form

<p>Please choose your favorite way(s) to relax:</p><input type="checkbox" name="reading" id="reading" />Reading<br /><input type="checkbox" name="sports" id="sports" />Sports<br /><input type="checkbox" name="games" id="games" />Computer Games<br /><input type="checkbox" name="tv" id="tv" />Television<br /> ...

Get Spring Into HTML and CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.