- Home
- /
- Textarea & Select
HTML Tutorial
INTRODUCTION
HTML BASIC TAGS
INLINE & BLOCK ELEMENTS
HTML LISTS
HTML TABLES
HTML FORMS
HEAD ELEMENTS
HTML MEDIA
MISCELLANEOUS TAGS
- Home
- /
- Textarea & Select
Textarea & Select
In addition to standard inputs fields, HTML provides more versatile form control like <textarea>
for a multiline text and <select>
for dropdown menus. These elements enhance user interaction and allow for richer data collection.
Textarea Element
Use the <textarea>
tag when you want user to enter long or multiline input, such as comments or feedback.
rows
control the height (number of lines).cols
control the width (numbers of characters).- Default text appears between the opening and closing
<textarea>
tags.
Select Element (Dropdown Menu)
The <select>
element creates a dropdown list. Use it when users need to pick one value from a predefined list.
- Each
<option>
is an item in the list. - The value attribute is the data sent to the server when submitted.
Combine Textarea and Select in a Form
You can use both elements together to collect diverse types of inputs in one form.
This example collects a comment and a selected fruit, then sends the data when the user clicks Submit.
Conclusion
The <textarea>
and <select>
tags help you create more dynamic and flexible forms. Using them effectively improves usability and enables better data inputs from users.