/    Sign up×
Reference /Pin to ProfileBookmark

The textarea tag designates a multi-line text input, often used in a form to collect user input such as comments.

Syntax

The <textarea>‘s size is set using the cols and rows attributes.

<label for="example">Example text area</label>

<textarea id="example" name="example" rows="8" cols="40">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce ornare enim ut cursus pellentesque. Vestibulum nec porttitor dolor. Nunc molestie venenatis mauris.
</textarea>

Attributes

autofocus

Designates whether the <textarea> should automatically get focus upon page load or not.

cols
Provides the width in pixels of the <textarea>.

dirname
Designates whether the <textarea> text direction will be submitted or not.

disabled
Designates whether the <textarea> should be disabled.

form
Designates the form id that the <textarea> belongs to.

maxlength
Determines the maximum amount of characters allowed in the <textarea> element.

name
Provides the name of the <textarea> element. Required for the data from the <textarea> to be submitted with the form.

placeholder
Provides a hint description of the expected value for the <textarea> element.

readonly
Designates that the <textarea> element is read-only.

required
Designates that the <textarea> element must be filled out before the form will be submitted.

rows
Numerical value of the number of lines in the <textarea>.

wrap
Designates how text in the <textarea> should be wrapped when the form is submitted. Possible values: hard or soft.

Browser Compatibilty

Demos

User-submitted codepen.io examples of <textarea>

@steime

See the Pen on CodePen.

Want to Contribute?

Submit a codepen.io link that demonstrates <textarea>:

to submit a demo.
HTML
×

Success!

Help @reference spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...