HTML <textarea> Tag
Description
The <textarea>
HTML element is a form element for creating an area into which multiple lines of text can be entered. In contrast to the <input>
element, it is permissible to do line breaks in the text field; they are preserved when sending data to the server.
Between the <textarea> and </textarea> tags you can put any text that will be displayed inside the field.
Properties
- Permitted Parents
- Any element that accepts phrasing content
- Content
- Text
- Start/End Tags
- Start tag: required, End tag: required
Example
<textarea cols="40">
You can write whatever text you want in the textarea.
</textarea>
Attributes
Attribute | Definition |
---|---|
autofocus | Specifies that a text area should automatically get focus when the page loads |
cols | Specifies the width of the textarea based on the number of visible character widths. |
dirname | Specifies that the text direction of the textarea will be submitted |
disabled | Disables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing. |
form | Specifies one or more forms the text area belongs to |
maxlength | Specifies the maximum number of characters allowed in the text area |
name | Assigns a name to the input control. |
placeholder | Specifies a short hint that describes the expected value of a text area |
readonly | Sets the textarea to read-only - it won't allow the user to change the value. The textarea however, can receive focus and is included when tabbing through the form controls. |
required | Specifies that a text area is required/must be filled out |
rows | Specifies the height of the textarea based on the number of visible lines of text. If there's more text than this allows, users can scroll using the textarea's scrollbars. |
wrap | Specifies how the text in a text area is to be wrapped when submitted in a form |
Global Attributes
The <textarea>
tag also supports the Global Attributes in HTML5
Event Attributes
The <textarea>
tag also supports the Event Attributes in HTML5
Browser Support
Desktop | |||||
Yes | Yes | Yes | Yes | Yes | Yes |
Tablets / Mobile | |||||
![]() |
|||||
Yes | Yes | Yes | Yes | Yes | Yes |
Last updated by CSSPortal on: 6th December 2019
HTML Tags
- a
- abbr
- address
- area
- article
- aside
- audio
- b
- base
- bdi
- bdo
- blockquote
- body
- br
- button
- canvas
- caption
- cite
- code
- col
- colgroup
- comment
- datalist
- dd
- del
- details
- dfn
- dialog
- div
- dl
- doctype
- dt
- em
- embed
- fieldset
- figcaption
- figure
- footer
- form
- h1
- h2
- h3
- h4
- h5
- h6
- head
- header
- hr
- html
- i
- iframe
- img
- input
- ins
- kbd
- keygen
- label
- legend
- li
- link
- map
- mark
- menu
- meta
- meter
- nav
- noscript
- object
- ol
- optgroup
- option
- output
- p
- param
- picture
- pre
- progress
- q
- rp
- rt
- ruby
- s
- samp
- script
- section
- select
- small
- source
- span
- strong
- style
- sub
- summary
- sup
- table
- tbody
- td
- textarea
- tfoot
- th
- thead
- time
- title
- tr
- track
- u
- ul
- var
- video
- wbr