What are the attributes of the textarea tag in HTML?

coldplay.xixi
Release: 2022-12-30 11:13:01
Original
24838 people have browsed it

The attributes of the textarea tag in HTML are: 1. cols is a vertical column; 2. name, the name of the text box; 3. warp, when [warp="off"] means that the text area is not automatically Line wrap; 4. rows horizontal columns; 5. class is generally used to call settings in external css.

The operating environment of this article: Acer S40-51, HBuilderX.3.0.5&&HTML5 version, Windows10 Home Chinese version

Related learning recommendations:html video tutorial

The attributes of the textarea tag in HTML are:

1,cols, vertical column. Without setting the style sheet, it represents the number of bytes that can fit in one line. For example, cols=60 means that a line can hold up to 60 bytes, which is 30 Chinese characters. Another thing to note is that the width of the text box is adjusted through this. Enter the value of cols, and then define the size of the input text font (if not defined, the default value will be used), then the width of the text box will be determined.

2,rows, horizontal columns. Indicates the number of rows that can be displayed. For example, rows=10 means that 10 rows can be displayed. If there are more than 10 lines, you need to drag the scroll bar to browse. (Same as above, the height of the text box is controlled through this.)

3,name, the name of the text box, this is essential because it must be used when storing text .

4,warp, when warp="off" means that the text area will not wrap automatically. Of course, if it is not written, it will wrap automatically by default. This parameter is generally used less frequently.

5,style, this is a very practical parameter, which can be used to set the background color of the text box, the color and form of the scroll bar, the border color, the size and color of the input font, etc.

6,class, are generally used to call settings in external css.

Example 1: Set the number of rows of the text box to 40 and the number of columns to 10. The name is text. Expression form

Copy after login

Example 2: Cancel the scroll bar on the right side of the text box. The expression

。style="overflow:auto"
Copy after login

means that the scroll bar will be automatically displayed when the input text exceeds the set number of lines.

Example 3: Set the background color of the text box.

Copy after login

Example 4: In addition, setting the scroll bar color, border color, font size, color, line spacing, etc. of the text box can be set directly in style. However, these are generally set in CSS and can be called directly.

The following is a piece of CSS setting code: it should be easier to understand. What is set in the textbox is the background color of the text box, the color and thickness of the upper, lower, left and right borders, and the size of the input font, etc.

Copy after login

Insert the above code betweenand

on the page. Calling method:

Copy after login

The name in class="" corresponds to the name of the setting to be used in css. Once you are familiar with these parameters, it will be very convenient to modify and beautify the text input box.

Example:

    php中文网  

Copy after login

If you want to know more about programming learning, please pay attention to thephp trainingcolumn!

The above is the detailed content of What are the attributes of the textarea tag in HTML?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!