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
<textarea cols=40 rows=10 name=text></textarea>
Example 2: Cancel the scroll bar on the right side of the text box. The expression
<textarea cols=40 rows=10 name=text style="overflow:auto"></textarea>。style="overflow:auto"
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.
<textarea cols=40 rows=10 name=text style="background-color:BFCEDC"></textarea>
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.
<style> .textbox { BACKGROUND: #BFCEDC; BORDER-TOP: #7F9DB9 1px solid; BORDER-LEFT: #7F9DB9 1px solid; BORDER-RIGHT: #7F9DB9 1px solid; BORDER-BOTTOM: #7F9DB9 1px solid; FONT-FAMILY: "宋体", "Verdana", "Arial", "Helvetica"; FONT-SIZE: 12px; TEXT-ALIGN: LIFT;} </style>
Insert the above code between
and on the page. Calling method:<textarea cols=40 rows=10 name=text class="textbox"></textarea>
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:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网</title> <script> function displayResult() { alert(document.getElementById("myTextarea").value); } </script> </head> <body> <textarea id="myTextarea" cols="20"> 在php中文网,你可以学多很多编程的基础知识,包括 HTML, XML, SQL, 和 PHP 等各种前端内容。 </textarea> <br> <button type="button" onclick="displayResult()">弹出 textarea 元素的文本</button> </body> </html>
If you want to know more about programming learning, please pay attention to the php training column!
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!

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function