HTML5 Form Elements
The <form> Element
The HTML
<form>
element defines a form that is used to collect user input:
Here are the different input types you can use in HTML:
<input type="button">
<input type="checkbox">
<input type="color">
<input type="date">
<input type="datetime-local">
<input type="email">
<input type="file">
<input type="hidden">
<input type="image">
<input type="month">
<input type="number">
<input type="password">
<input type="radio">
<input type="range">
<input type="reset">
<input type="search">
<input type="submit">
<input type="tel">
<input type="text">
<input type="time">
<input type="url">
<input type="week">
Here is the sample code
<!DOCTYPE html>
<html>
<h1>Sample HTML Developed by Pranay Tiwari</h1>
<body>
<form>
<!--Declaration of First Name as Text input Field-->
<label for="fname">First Name </label>
<input type="text" id="fname" name="fname"</input><br>
<!--Declaration of First Name as Text input Field-->
<label for="lname">Last Name </label>
<input type="text" id="lname" name="lname"</input><br>
<!--Declaration of Radio Button-->
<input type="radio" id="male" name="gender" value="male"</input>
<label for="male">Male</label><br>
<input type="radio" id="female" name="gender" value="female"</input>
<label for="female">Female </label><br>
<input type="checkbox" id="books" name="books" value="books">
<Label for="books"> Think and Grow Rich </Label><br>
<input type="checkbox" id="books" name="books" value="books">
<Label for="books"> Flight of Hope </Label><br>
<!--Button Declaration-->
<input type="submit" id="submitbtn" value="Submit"</input>
</form>
</body>
</html>
Output will be like this
Comments
Post a Comment