English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
HTML <fieldset> tag is located within the <form> tag and is used to group related elements in HTML forms. Use the <legend> tag to create a title for the <fieldset>. This tag is also commonly referred to as the <fieldset> element.
Group related elements in the form:
!doctype html <html> <head> <meta charset="UTF-8"> <title>HTML5 Usage of fieldset tag (Basic Tutorial Website oldtoolbag.com)</title> </head> <body> <form> <fieldset> <legend>Customer Information(oldtoolbag.com)</legend> Name: <input type="text"><br> Address: <input type="text"><br> Phone Number: <input type="text"> </fieldset> </form> </body> </html>Test and see ‹/›
The effect after running is as follows:
IEFirefoxOperaChromeSafari
All major browsers support the <fieldset> tag.
The <fieldset> tag can group related elements within a form.
The <fieldset> tag draws a border around the surrounding form elements.
Most browsers will display a black border around the <fieldset> tag, but you can use CSS to change this behavior.
You can use the <legend> tag to display the title of the <fieldset>. This title will be presented before the related form controls within the <fieldset> and will appear floating above the top border of the <fieldset>.
Tip:<legend> The <legend> tag defines a title for the <fieldset> element.
HTML5 New attributes added to <fieldset> in HTML: disabled, form, name, HTML 4.01 These attributes are not supported in Chinese.
Attribute | Value | Description |
---|---|---|
disabledHTML5 | disabled | Specifies that the form elements in this group should be disabled. |
formHTML5 | form_id | Specifies one or more forms that the fieldset belongs to. |
nameHTML5 | text | Specifies the name of the fieldset. |
Support for <fieldset> tag Global Attributes of HTML.
Support for <fieldset> tag HTML Event Attributes.