html
  1. html-fieldset-tag

HTML <fieldset> Tag

  • The <fieldset> tag in HTML is used to group related elements within a form.
  • It's often paired with the <legend> tag to provide a title or description for the grouped elements.

<fieldset>
    <legend>Login Form</legend>
    <label for="username">Username:</label>
    <input type="text" id="username" name="username"><br><br>

    <label for="password">Password:</label>
    <input type="password" id="password" name="password"><br><br>

    <input type="submit" value="Submit">
</fieldset>
Try Playground
  • <fieldset> creates a grouping container for related form elements.
  • <legend> provides a title or description for the grouped elements, helping to identify the purpose of the fields within the fieldset.
  • Labels and input fields are placed within each <fieldset>, organizing them into different sections.
Summary

The <fieldset> tag provides a visual grouping and helps with accessibility by associating related elements within a form.

Published on: