Home > Web Front-end > HTML Tutorial > How to set the size of html text area

How to set the size of html text area

青灯夜游
Release: 2023-01-07 11:41:36
Original
9486 people have browsed it

In HTML, you can use the cols and rows attributes of the textarea tag to set the size of the text area. The cols attribute specifies the visible width in the text area, and the rows attribute specifies the number of visible lines in the text area; the syntax "< ;textarea rows="numeric value" cols="numeric value">".

How to set the size of html text area

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

The text area can hold an unlimited amount of text, and the default font for the text is a fixed-width font (usually Courier).

The size of the textarea can be specified through the cols and rows attributes.

  • The cols attribute can specify the visible width within the text area.

  • The rows attribute can specify the number of visible lines in the text area.

Example:

<!DOCTYPE html>
<html>
	<head> 
		<meta charset="utf-8"> 
	</head>
	<body>
		<textarea rows="6" cols="50">测试文本</textarea>
		<br><br><br>
		<textarea rows="10" cols="40">测试文本</textarea>
	</body>
</html>
Copy after login

Rendering:

How to set the size of html text area

Recommended tutorial: "html Video tutorial

The above is the detailed content of How to set the size of html text area. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template