Grouping a few input fields
suggest changeWhile designing a form, you might like to group a few input fields together to help organise the form layout. This can be done with the <fieldset> element. Here is an example.
For each fieldset, you can set a caption for the group with the <legend> element.
Example
<form>
<fieldset>
<legend>1st field set:</legend>
Field one:<br>
<input type="text"><br>
Field two:<br>
<input type="text"><br>
</fieldset><br>
<fieldset>
<legend>2nd field set:</legend>
Field three:<br>
<input type="text"><br>
Field four:<br>
<input type="text"><br>
</fieldset><br>
<input type="submit" value="Submit">
</form>
Result
Browser Support
Current versions of Chrome, IE, Edge, Firefox, Safari, and Opera support <fieldset> and <legend>.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents