← CodePrimer
HTML
Beginner
Forms
Radio button group
How do I let users pick only one option?
Shared name groups radios.
<fieldset>
<legend>Year level</legend>
<label><input type="radio" name="year" value="1" required> 1st</label>
<label><input type="radio" name="year" value="2"> 2nd</label>
<label><input type="radio" name="year" value="3"> 3rd</label>
</fieldset>
Notes
Same name makes the choice exclusive.
Keywords: radio · form · choice
Related
HTML
HTML headings h1–h6
How do I create page headings?
HTML
Paragraphs and line breaks
How do I break text into paragraphs?
HTML
Hyperlinks with href
How do I make a clickable link?
HTML
Ordered and unordered lists
How do I make bullet or numbered lists?
HTML
HTML table structure
How do I display tabular data?
HTML
Image with alt text
How do I insert an image accessibly?