English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag List

HTML: <fieldset> form Attribute

This article introduces the usage of the HTML fieldset form attribute, with online examples demonstrating how to use the HTML fieldset form attribute, browser compatibility, syntax definition, and detailed information about its attribute values.

 HTML <fieldset> tag

Online Example

The <fieldset> element located outside the form (but still part of the form):

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML <fieldset> form Attribute Usage-基础教程(oldtoolbag.com)</title>
</head>
<body>
<form action="action_page.php" method="get" id="form1">
What is your favorite color? <input type="text" name="fav_color"><br>
<input type="submit">
</form>
<p>The fieldset below is outside the form, but it is still part of the form./p>
<fieldset form="form1">
  <legend>Personalia:</legend>
  Name: <input type="text" name="username"><br>
  Email: <input type="text" name="usermail"><br>
</fieldset>
</body>
</html>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Currently, only Opera supports the form attribute.

Definition and Usage

The form attribute specifies one or more forms that the fieldset belongs to.

HTML 4.01 and HTML5differences between

The form attribute in HTML5 new attribute in the syntax.

Syntax

<fieldset form="form_id">

Attribute Value

ValueDescription
form_idSpecify a space-separated list of one or more form ids that the fieldset belongs to.
 HTML <fieldset> tag