The use of textarea in HTML and its common problems and case analysis

Time:2021-2-25

Textarea tag is an HTML tag that we often use, mainly when we input long text, it can achieve the effect of line feed and so on. Here’s a basic use:
Textarea tag — represents the multi line input field of HTML form
Textarea tags appear in pairs, starting with < textarea > and ending with < / textarea >
attribute:
Common — general property
Cols — number of columns in multi row input field
Rows — the number of rows in the multi row input field
AccessKey — shortcut key access to form
Disabled — input fields cannot get focus, cannot be selected, are grayed out, and do not work in the form
Readonly — the input field can be selected, but cannot be modified
TabIndex — input field, traversal order using “tab” key
The use cases are as follows:
HTML code:

Copy code

The code is as follows:

<form action=”#” method=”post”>
The < / textarea > on the line of < textarea cols = (50) rows = (10) name = (contactus) > label
</form>

You can copy the code to the local test.
If the two < textarea > < / textarea > are not on the same line, for example
Branch writing effect will be different code

Copy code

The code is as follows:

<form action=”#” method=”post”>
<textarea>
This is where the textarea label is not on line by line
The effect will be different
</textarea>
</form>

You’ll find outThe first code is left aligned, and the next one is centered. Therefore, when using textarea, we must pay attention to the fact that the text in the textarea label is relative to textarea. Textarea is equivalent to providing an editing area, which starts immediately after textarea, that is, what you see is what you get. As long as the two labels are not on the same line, the blank space in front of < / textarea > will also be recognized as blank text. You will find that your mouse editing pointer will not flash at the beginning of the text or next to the text. So make good use of this label and know where to start when you encounter problems.

It’s a bit of a mess. You should be able to understand it in a small experiment. Hehe 0_*