How we can group data in HTML forms?

HTMLWeb DevelopmentFront End Technology

To group related data in HTML forms use the <fieldset> tag. This tag creates a box around the related elements. The <legend> tag is used inside the <fieldset> tag to give a caption to the group.

Example

You can try to run the following code to group data in HTML forms −

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <form>
         <fieldset>
            <legend>Student Information:</legend>
            Student Name:<br>
            <input type="text" name="sname">
            <br>
            Student Subject:<br>
            <input type="text" name="ssubject">
            <br>
         </fieldset>
      </form>
   </body>
</html>
raja
Published on 07-Feb-2018 12:36:35
Advertisements