Computer >> Computer tutorials >  >> Programming >> HTML

How to display a fieldset in HTML?


The HTML <fieldset> tag is used for grouping related form elements and display fieldset. By using the fieldset tag and the legend tag, you can make your forms much easier to understand for your users.

Example

You can try to run the following code to display a fieldset in HTML −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML fieldset Tag</title>
   </head>
   <body>
      <form>
         <fieldset>
            <legend>Details</legend>
            Student ID: <input type = "number"><br />
            Subjects:<input type = "text"><br />
         </fieldset>
      </form>
   </body>
</html>