HTML & CSS · Junior · Question 57 of 75

How should a group of related radio buttons be marked up?

<fieldset>
  <legend>Delivery</legend>
  <label><input type="radio" name="delivery" value="courier" /> Courier</label>
  <label><input type="radio" name="delivery" value="pickup" /> Pickup</label>
</fieldset>

Explanation

The shared name makes them mutually exclusive. <legend> is announced as the group's label, so the user knows what "Courier" refers to.

Further reading

Problem with a question

HTML & CSS · Junior · question 57

Test yourself

Take the HTML & CSS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz