Learn how to use the HTML `<legend>` element to create clear and descriptive labels for groups of form elements within `` containers. This tutorial explains its proper placement, demonstrates its use in improving form organization and accessibility, and shows how to customize its appearance using CSS. The HTML `<legend>` element defines a caption for a `` element. A `` is a container for grouping related form elements, improving the visual organization and structure of web forms. The `<legend>` element provides a descriptive label for this group, enhancing usability and making it clear to the user what the group of form elements represents. The `<legend>` element must be the first child element of the `` element. It should provide a concise label for the contained form elements. For example: You can customize the appearance of the `<legend>` element using CSS. For example, you can change its position and alignment: The `<legend>` element is widely supported by modern browsers. Most browsers render the legend text in bold and display it as a caption for the fieldset. The default styling generally includes displaying it as a block-level element.