Forms
Use meaningful markup like lists and paragrapgs to give forms a logical structure. A form control should almost always be paired with a useful label.
Text input
Input with placeholder
Field placeholders should show an example of the expected input, such as
suggested search terms or a demonstration of a correctly formatted email address.
The placeholder
attribute should not be used
as a substitute for a label.
Text area
Radio buttons
Radio buttons represent a set of options where only one may be selected.
Checkboxes
Checkboxes represent a set of options where multiple selections are allowed.
Also use a checkbox for a binary choice (such as a yes or no question) rather than two radio buttons. A radio button, once activated, cannot be deactivated, whereas a single checkbox behaves as a switch to let a user toggle between the two states (you can uncheck a checked checkbox).
Select
Fieldset with legend
Use fieldset
to group related fields together. Include a
legend
as a title.