Create Semantic, Accessible HTML for Radio Buttons and Checkboxes

Share this video with your friends

Send Tweet

We'll round out the HTML for our form fields by adding radio buttons and checkboxes, including each in a checked, unchecked and disabled state. You'll learn about best practices for both field types semantically as well as when to use each.

Radio buttons should be used when you want a single selection out of a set of options while checkboxes should be used when you want multiple selections out of a set. A key difference between radio/checkbox and other inputs is that you wrap the label around the options which creates a direct relationship between the label and input so a for attribute is not strictly necessary.