Skip to content

<textarea> - The Text Area Element

Form Control HTML 2.0

The textarea element creates a multi-line text input control, perfect for comments, messages, descriptions, and any content that requires multiple lines.

Result
<textarea name="fieldname" rows="4" cols="50">
Default text goes here
</textarea>

Unlike <input>, the textarea requires a closing tag. Any text between the tags becomes the default value.

AttributeDescriptionExample
nameName for form dataname="comment"
rowsVisible number of text rowsrows="5"
colsVisible width in characterscols="40"
placeholderHint text when emptyplaceholder="Enter text..."
requiredMakes field mandatoryrequired
disabledDisables the textareadisabled
readonlyMakes textarea read-onlyreadonly
autofocusAuto-focus on page loadautofocus
AttributeDescriptionExample
minlengthMinimum character countminlength="10"
maxlengthMaximum character countmaxlength="500"
AttributeDescriptionValues
autocompleteEnable/disable autocompleteon, off
wrapHow text wraps when submittedsoft, hard
spellcheckEnable spell checkingtrue, false
formAssociates with form by IDForm element ID
dirnameSubmit text directionalityField name for direction
Result
Result
Result
Result
Result
Result
Result
Result
Result
Result
Result
Result
Result
<label for="comments">Comments:</label>
<textarea id="comments" name="comments" rows="4"></textarea>
Result
Result
Result
BrowserVersionNotes
Chrome1+Full support
Firefox1+Full support
Safari1+Full support
Edge12+Full support
IE3+Full support

The <textarea> element has been supported since the earliest browsers. Modern validation attributes require HTML5-capable browsers.