Fieldsets and Legends - HTML

Sometimes, it is advantageous to visually group certain controls on your form. This is a standard practice for graphical user agents.

The <fieldset> tag is used as a container for form elements and results in a thin border being displayed around the elements it surrounds. For example, the following code results in the output.

Grouping controls allows a user to better understand a form’s organization. This is standard in GUI interfaces, as demonstrated in this Windows Internet Explorer dialog box.

Grouping controls allows a user to better understand a form’s organization

The <legend> tag allows the surrounding <fieldset> box to be captioned. For example, the following code adds a caption to the previous example. The output of this change.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

HTML Topics