<form> Element:
HTML forms are used to collect information from the user. Forms are defined using the <form> element, with its opening and closing tags. It is used to take user input, we need corresponding form elements, such as text fields. The <input> element has many variations, depending on the type attribute.
It can be a text, password, radio, URL, submit, etc.
Example:
<input> Tag:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form>
<input type="text"><br>
<input type="password"><br>
<input type="email">
</form>
</body>
</html>
Label Tag:
The <label> Tag is used to specify a label for an <input> element of a form.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form>
<label>Name:</label>
<input type="text"><br>
<label>Password:</label>
<input type="password"><br>
<label>Email:</label>
<input type="email">
</form>
</body>
</html>
Radio Button:
If we change the input type to radio, it allows the user select only one of a number of choices.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form>
<input type="radio">Male
<input type="radio">Female
</form>
</body>
</html>
Checkbox:
The type="checkbox" allows the user to select more than one option.
<body>
<form>
<input type="checkbox">HTML
<input type="checkbox">CSS
<input type="checkbox">JavaScript
</form>
</body>
Button Creation:
If the type attribute has submit value, a submit button will form.
<body>
<form>
<input type="submit">
</form>
</body>
The submit button submits a form.
To change the name of the button, use attribute value.
Example:
<body>
<form>
<input type="submit" value="send">
</form>
</body>
A Simple Form for better Understanding:
<body>
<form align="center">
<label>Name</label>
<input type="text"><br>
<label>Age</label>
<input type="text"><br>
<label>Email</label>
<input type="email"><br>
<label>password</label>
<input type="password"><br>
<input type="submit">
</form>
</body>
Practice in this HTML code editor
//Practice your code here