May 03, 2021 HTML5
HTML5 is used to create a text box that can enter multiple lines. Please refer to the following example:
An HTML text area:
<textarea rows="10" cols="30">
我是一个文本框。
</textarea>
All major browsers support the hashtags.
The label defines a multi-line text input control.
An unlimited amount of text can be accommodated in a text area, where the default font for text is an equal width font (usually Courier).
You can specify the size of textarea by using the cols and rows properties, but a better approach is to use the height and width properties of CSS.
HTML5 adds some new properties.
New: The new property in HTML5.
Property | Value | Describe |
---|---|---|
autofocus New | autofocus | Specifies that the text area automatically gets focus when the page is loaded. |
cols | number | Specifies the number of columns visible within the text area. |
disabled | disabled | The text area is specified to be disabled. |
form New | form_id | Define one or more forms to which a text area belongs. |
maxlength New | number | Specifies the maximum number of characters allowed in the text area. |
name | text | Specify the name of the text area. |
placeholder New | text | Specify a short prompt that describes the expected input value for the text area. |
readonly | readonly | Make the text area read-only. |
required New | required | Specify that the text area is required/required. |
rows | number | Specifies the number of lines visible within the text area. |
wrap New |
hard
soft |
Specify how the text in the text area should line up when the form is submitted. |
The label supports the global properties of HTML.
The tag supports the event properties of HTML.
HTML DOM Reference Manual: Textarea Object