DEV Community

Cover image for HTML tags | fieldset
Carlos Espada
Carlos Espada

Posted on • Edited on

HTML tags | fieldset

It is used to group related elements within a form. It usually generates a border around it, modifiable with CSS.

Besides name, it has two main attributes:

  • disabled to disable all form elements contained within the <fieldset> and not receiving navigation events (click, focus)
  • form to, taking as value the id of a <form>, associate the <fieldset> to said form even if it is not contained within it. The latter is confusing and is not recommended, if you want to establish that link it is better to associate the form elements it contains one by one.

A title can be set for each <fieldset> using <legend> as the first child.

  • Type: block
  • Self-closing: No
  • Semantic value: No

Definition and example | Support

Top comments (0)

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay