HTML <input type=”checkbox”>
The HTML <input type=”checkbox”> creates a checkbox input element. It displays as a square box, checked when activated. Checkboxes enable users to select one or more options from a limited set of choices.
Syntax
<input type="checkbox">
Example: In this example, we will demonstrate using the HTML <input type=”checkbox”> element.
<!DOCTYPE html>
<html>
<head>
<title>
HTML Input Type Checkbox
</title>
<style>
h2 {
text-align: center;
}
fieldset {
width: 250px;
margin: auto;
}
</style>
</head>
<body>
<h2>HTML <input type="checkbox"></h2>
<form action="#">
<fieldset>
<legend>Select Your Subjects:</legend>
<input type="checkbox"
name="check"
id="checkbox1"
value="html" checked>
<label for="checkbox1">HTML</label>
<br>
<input type="checkbox"
name="check"
id="checkbox2"
value="css">
<label for="checkbox2">CSS</label>
<br>
<input type="checkbox"
name="check"
id="checkbox3"
value="javascript">
<label for="checkbox3">JavaScript</label>
</fieldset>
</form>
</body>
</html>
Output
Contact Us