HTML <fieldset> Tag
The HTML <fieldset> Tag is used to clustering logically connected fields/labels in the Associate Hypertext Markup Language type.
The use of this tag is optional when creating HTML forms, but using <filedset>, it is easier to understand the purpose of the grouped elements of the form.
The <legend> Tag is worked with the <fieldset> element as the primary child to outline the citation for the tagged connected fields.
Create a contact form using the HTML <legend> Tag and use the fieldset to give the title to the form. The fieldset is used to give the title to any group.
Example:-
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
HTML fieldset Tag
</title>
</head>
<style>
form{
background: #1C9CEA;
padding: 10px;
width: 250px;
}
fieldset{
border: 2px solid;
}
legend{
font-size: 25px;
}
label{
font-weight: bold;
}
</style>
<body>
<h1>Example of HTML Fieldset tag</h1>
<h2>Get Into Touch</h2>
<form action="#">
<fieldset>
<legend>Contact Us</legend>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname"><br><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email"><br><br>
<label for="num"> Number:</label><br>
<input type="number" id="num" name="Number"><br><br>
<input type="submit" value="Submit">
</fieldset>
</form>
</body>
</html>
Output:-
Attribute
disabled
form
name
One thought on “HTML Fieldset Tag”