<fieldset>...</fieldset>

HTML4 HTML5

Used to group related elements within a form. Visually creates a box around contained fields, and combined with <legend>, allows adding a title/label for the group.

Both opening and closing tags are required.

Attributes:

disabled - Disables all form controls inside the fieldset.

form="..." - Specifies the ID of the form the fieldset belongs to (if outside of it).

name="..." - Name of the group.

Example

Code:

<fieldset style="border: 1px solid #ccc; padding: 10px; border-radius: 4px;"> <legend style="font-weight: bold; padding: 0 5px;">Contact Information</legend> <label for="email">E-mail:</label><br> <input type="email" id="email" name="email" placeholder="jan@example.com" style="margin-top: 5px; margin-bottom: 10px; padding: 5px;"><br> <label for="phone">Phone:</label><br> <input type="tel" id="phone" name="phone" placeholder="+48 123 456 789" style="margin-top: 5px; padding: 5px;"> </fieldset>

The browser will interpret this code as follows:

Contact Information