HTML Input Types
HTML
<input>
elements creates and carry input information in the form.
Form input type="text"
<input type="text">
is used for plain text information in one line.
type="text"
defines a single-line text for a input field.
Browsers read HTML document to display web contents properly.
The HTML text input look like below in a browser:
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Form Example</title>
<meta charset="utf-8" />
</head>
<body>
<h2>Form Example</h2>
<form action="" method="get" class="form-example">
<div class="form-group">
<label for="name">Enter your name: </label>
<input type="text" name="name" id="name" required>
</div>
<div class="form-group">
<label for="email">Enter your email: </label>
<input type="email" name="email" id="email" required>
</div>
<div class="form-group">
<input type="submit" value="Subscribe!">
</div>
</form>
</body>
</html>
Click on the "Try Now" button to see how it works.
Form input type="radio"
<input type="text">
is used for plain text information in one line.
type="text"
defines a single-line text for a input field.
Browsers read HTML document to display web contents properly.
The HTML radio input look like below in a browser:
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Form Example</title>
<meta charset="utf-8" />
</head>
<body>
<h2>Form Example</h2>
<form action="" method="get" class="form-example">
<div class="form-group">
<label for="name">Enter your name: </label>
<input type="text" name="name" id="name" required>
</div>
<div class="form-group">
<label for="email">Enter your email: </label>
<input type="email" name="email" id="email" required>
</div>
<div class="form-group">
<input type="submit" value="Subscribe!">
</div>
</form>
</body>
</html>
Click on the "Try Now" button to see how it works.
Form input type="checkbox"
<input type="text">
is used for plain text information in one line.
type="text"
defines a single-line text for a input field.
Browsers read HTML document to display web contents properly.
The HTML checkbox input look like below in a browser:
Example
<form>
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bicycle">
<label for="vehicle1"> I can drive bicycle</label>
<br>
<input type="checkbox" id="vehicle2" name="vehicle2" value="Bike">
<label for="vehicle2"> I can drive bike</label>
<br>
<input type="checkbox" id="vehicle3" name="vehicle3" value="Car">
<label for="vehicle3"> I can drive car</label>
</form>
Click on the "Try Now" button to see how it works.