HTML fieldset Tag

HTML fieldset Tag is used to combine the group of elements that are related to each other, inside the HTML form element. HTML fieldset tag is used with legend tag.

Syntax of HTML fieldset Tag

The Syntax of HTML fieldset Tag is shown below, It has both starting and ending tags.

<fieldset>
// related tags
</fieldset>

Usage of HTML fieldset Tag

HTML fieldset Tag combines the group of related html elements that are present inside the form tag.

HTML fieldset Tag is used with the legend tag which is used for the caption of the fielset HTML element.

You can use form attribute inside the fieldset tag to specify which form the fieldset belongs to.

HTML fieldset Tag is a block level element.

By default HTML fielset tag has a border around it.

Example of HTML fieldset Tag

Simple example of HTML fieldset Tag is shown below.

<form>
  <fieldset>
    <legend>Student Form:</legend>
    <label for="name">Name:</label>
    <input type="text" id="name" name="name">
    <br>
    <br>
    <label for="class">Class:</label>
    <input type="text" id="class" name="class">
    <br>
    <br>  
    <label for="email">Email:</label>
    <input type="email" id="email" name="email">
    <br>
    <br>  
    <input type="submit" value="Submit">
  </fieldset>
</form>

Output

The output of above code is shown below.

Student Form:





Browser Support for HTML fieldset Tag

HTML fieldset Tag is supported by all major browsers including Safari and Internet Explorer.

Global Attributes Support in HTML fieldset Tag

The HTML fieldset Tag supports all Global Attributes.

Event Attributes Support in HTML fieldset Tag

The HTML fieldset Tag supports all Event Attributes.

HTML fieldset Tag Video

Watch our video on HTML fieldset Tag.

HTML Comment Tag HTML Doctype Tag HTML anchor Tag HTML abbr Tag HTML acronym Tag HTML address Tag HTML applet Tag HTML area Tag HTML article Tag HTML aside Tag HTML audio Tag HTML b Tag HTML base Tag HTML basefont Tag HTML bdi Tag HTML bdo Tag HTML big Tag HTML blockquote Tag HTML body Tag HTML br Tag HTML Button Tag HTML Canvas Tag HTML Caption Tag HTML Center Tag HTML Cite Tag HTML Code Tag HTML Col Tag HTML colgroup Tag HTML data Tag HTML datalist Tag HTML dd Tag HTML del Tag HTML details Tag HTML dfn Tag HTML dialog Tag HTML dir Tag HTML div Tag HTML dl Tag HTML dt Tag HTML em Tag HTML embed Tag HTML fieldset Tag HTML figcaption Tag HTML figure Tag HTML font Tag HTML footer Tag HTML form Tag HTML frame Tag HTML frameset Tag HTML Heading Tags HTML head Tag HTML header Tag HTML hr Tag HTML html Tag