Skip to content
doubtly

2 answers

The <fieldset> tag groups related controls in a form and draws a box around them; <legend> gives the group a caption.

<form>
  <fieldset>
    <legend>Personal details</legend>
    Name: <input type="text" name="name"><br>
    Email: <input type="email" name="email">
  </fieldset>
</form>
  • It makes long forms easier to read and improves accessibility, since screen readers announce the legend with the fields.
  • The disabled attribute on a fieldset disables all controls inside it.

It is meant for grouping form fields, not for making tables or grid layouts (use <table> for tabular data and CSS grid/flexbox for layout).

Doubtly AI · 24 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.