HTML Form Elements PDF
HTML Form Elements PDF
w3schools.com
The <input> element can be displayed in several ways, depending on the type
attribute.
Example
Try it Yourself »
If the type attribute is omitted, the input field gets the default type: "text".
All the different input types are covered in the next chapter: HTML Input Types.
Example
Try it Yourself »
Example
Try it Yourself »
Visible Values:
Use the size attribute to specify the number of visible values:
Example
<option value="audi">Audi</option>
</select>
Try it Yourself »
Example
Try it Yourself »
Example
<textarea name="message" rows="10" cols="30">
The cat was playing in the garden.
</textarea>
Try it Yourself »
The rows attribute specifies the visible number of lines in a text area.
You can also define the size of the text area by using CSS:
Example
Try it Yourself »
Example
Try it Yourself »
Click Me!
file:///C:/Users/Peregrin0/Documents/cursos programacion/www.w3schools.com/html/html_form_elements.html 4/11
21/4/2020 HTML Form Elements
Note: Always specify the type attribute for the button element. Different browsers
may use different default types for the button element.
Example
<form action="/action_page.php">
<fieldset>
<legend>Personalia:</legend>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</fieldset>
</form>
Try it Yourself »
Personalia:
First name:
John
Last name:
Doe
Submit
Users will see a drop-down list of the pre-defined options as they input data.
The list attribute of the <input> element, must refer to the id attribute of the
<datalist> element.
Example
<form action="/action_page.php">
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
Try it Yourself »
Example
Perform a calculation and show the result in an <output> element:
<form action="/action_page.php"
oninput="x.value=parseInt(a.value)+parseInt(b.value)">
0
<input type="range" id="a" name="a" value="50">
100 +
<input type="number" id="b" name="b" value="50">
=
<output name="x" for="a b"></output>
<br><br>
<input type="submit">
</form>
Try it Yourself »
HTML Exercises
Exercise:
In the form below, add an empty drop down list with the name "cars".
<form action="/action_page.php">
< >
</ >
</form>
Submit Answer »
For a complete list of all available HTML tags, visit our HTML Tag Reference.
❮ Previous Next ❯
COLOR PICKER
HOW TO
Tabs
Dropdowns
Accordions
Side Navigation
Top Navigation
file:///C:/Users/Peregrin0/Documents/cursos programacion/www.w3schools.com/html/html_form_elements.html 8/11
21/4/2020 HTML Form Elements
Modal Boxes
Progress Bars
Parallax
Login Form
HTML Includes
Google Maps
Range Sliders
Tooltips
Slideshow
Filter List
Sort List
SHARE
CERTIFICATES
HTML
CSS
JavaScript
SQL
Python
PHP
jQuery
Bootstrap
XML
Read More »
REPORT ERROR
PRINT PAGE
FORUM
ABOUT
Top Tutorials
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
How To Tutorial
SQL Tutorial
Python Tutorial
W3.CSS Tutorial
Bootstrap Tutorial
PHP Tutorial
jQuery Tutorial
Java Tutorial
C++ Tutorial
Top References
HTML Reference
CSS Reference
JavaScript Reference
SQL Reference
Python Reference
W3.CSS Reference
Bootstrap Reference
PHP Reference
HTML Colors
jQuery Reference
Java Reference
Angular Reference
Top Examples
HTML Examples
CSS Examples
JavaScript Examples
How To Examples
SQL Examples
Python Examples
W3.CSS Examples
Bootstrap Examples
PHP Examples
jQuery Examples
Java Examples
XML Examples
Web Certificates
HTML Certificate
CSS Certificate
JavaScript Certificate
SQL Certificate
Python Certificate
jQuery Certificate
PHP Certificate
Bootstrap Certificate
XML Certificate
Get Certified »
W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve
reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid
errors, but we cannot warrant full correctness of all content. While using this site, you agree to have
read and accepted our terms of use, cookie and privacy policy. Copyright 1999-2020 by Refsnes Data.
All Rights Reserved.
Powered by W3.CSS.