tag. And this tag supports all the browsers like Chrome, android, firefox, Opera, Internet Explorer. And all these elements are uniform with all the browsers.
Code:
<fieldset>
<legend>
Text
</legend>
… Content
<fieldset>
Have to provide both the Starting and Ending Tags.
Attributes
In general, HTML tags has one or more attributes that provide a great aspect of an HTML element. The Legend Tag supports all the defined global attributes. Some attributes don’t support modern web browsers. The following table gives the tag attributes with their descriptions.
1. Tag-Specific Attributes
align: Defines an alignment of the title or caption given in the form with respect to the parent
.
Code:
<fieldset>
<legend align="center">Align
demo:</legend>
Note: For a clear alignment, it is better to use CSS-Align for the variations of an element.
2. Standard Attributes
The description of these attributes has already been discussed in the previous article.
Access key
class
dir
id
Style
lang
id
tab index
title
3. Global Attributes
The legend tag also accepts Previously discussed Global Attributes, which is a standard across all the HTML5 elements. Some are listed below:
Context
Define the Context
Dir
The values give the path of the text.
Id
Its identifier must match the value of a name.
Style
Specifies the inline and external styles.
Lang
Determines the language used in the text.
Context
onabort
It is called when a particular event has been aborted. For example, the web browser immediately video before it is completely downloaded.
onblur
Defines the focus of the element.
oncancel
Stops the processed event handler.
Onclick
Triggers when a click is done
onchange
When a click is done somewhere.
onfocus
Triggered when the focus is on the given element
Define the Context
Dir
The values give the path of the text.
Id
Its identifier must match the value of a name.
Style
Specifies the inline and external styles.
Lang
Determines the language used in the text.
4. Event Attributes
5. Other Attributes Are
onmouse down, onmouse up, onmouse over, onmouse move, onmouse out, on focus, on blur, onkey press,onkey down,onkey up. The tags that come with the tag are listed below:
Examples to Implement Area Tag in HTML
Below are the examples of implementing the area tag in HTML:
Example #1
This section focuses on the form and fieldset. Association of legend tags with the fieldset and preferring to use with the forms gives the best option.
Code:
<!DOCTYPE html>
<html>
<body>
<form>
<fieldset>
<legend>Personal Information:</legend>
FirstName: <input type="text"><br>
LastName: <input type="text"><br>
Email: <input type="text"><br>
Age: <input type="text">
</fieldset>
</form>
</body>
</html>
Output:
Example #2
The below examples show how the fieldset element groups the labels and radio buttons and checklist together. Meanwhile, the legend tag should be given for the caption for the group. A similar approach can be implemented with other controls.
Code:
<!DOCTYPE html>
<html>
<body>
<form action="http://www.educba.com/" method="post">
<fieldset>
<legend>Tutorial</legend>
<input type="radio" name="tutorial class" value="online" id="online">
<label for="online">Online</label>
<input type="radio" name="tutorial class" value="offline" id="offline">
<label for="offline">Offline</label>
</fieldset>
</form>
</body>
</html>
Output:
Example #3
In the following example, we group the information under the HTML tag
Statement: The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn