24. Selection Inputs: Checkboxes and Radio Buttons
These input types allow users to select from a predefined list of options.
24.1 Checkboxes (type="checkbox")
Checkboxes allow the user to select zero, one, or multiple options from a list.
html
24.2 Radio Buttons (type="radio")
Radio buttons allow the user to select only one option from a list of mutually exclusive choices.
Crucial Rule: All radio buttons in a group must share the exact same name attribute value. This is how the browser knows they belong together.
html
Preferred Contact Method:
24.3 Pre-selecting Options
Use the checked attribute to make an option selected by default.
html