The fieldset element allows us to group different form elements (controls) into thematically similar groups. That usually helps users understand better the larger forms as well as it makes a form more accessible via improved tabbing navigation.

The legend element is actually a caption of a fieldset.

By applying a proper styling (via a style sheet) to fieldsets and legends, we ensure that a user ends up with a much better experience upon finishing using the form.

Syntax:

<fieldset><legend></legend><input type="" name="" /><input type="" name="" /></fieldset>

Attributes:

Example

HTML fieldset and legend elements:

 

›› go to examples ››