<fieldset> and <legend>

The <fieldset> element represents a set of form controls optionally grouped under a common name.

The common name of the group is provided by the first child <legend> element of the <fieldset> element.

Browser Support

Note: The following information about browser support is from the MDN Web Docs HTML Elements Reference.

For <fieldset>

All versions of all browsers.

For <legend>

Default Browser Behavior

Content inside a <fieldset> element will be rendered as a block with a solid gray border.

Content inside a <legend> element will be rendered plainly, overlapping the top border of the parent <fieldset> element near its top-left corner.

Examples

Your shipping info:
Your T-shirt size: