"; 2. Add "width: width value; height: height value;" to exarea; "style."/> "; 2. Add "width: width value; height: height value;" to exarea; "style.">

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

How to set the size of html textarea

青灯夜游
青灯夜游Original
2021-12-13 16:09:3713876browse

Setting method: 1. Set the cols and rows attributes to textarea, the syntax is ""; 2. Add "width" to exarea :width value;height:height value;" style.

How to set the size of html textarea

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

html textarea set size

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

<textarea>我是一个文本框。</textarea>

How to set the size of html textarea

You can specify the size of the textarea through the cols and rows attributes, but a better way is to use the CSS height and width attributes.

1. Use the cols and rows attributes

  • cols: Specifies the visible width within the text area.

  • rows: Specifies the number of visible rows in the text area, that is, the height.

<textarea rows="10" cols="30">我是一个文本框。</textarea>

How to set the size of html textarea

2. Use CSS height and width attributes

<textarea style="width: 200px;height: 100px;">我是一个文本框。</textarea>

How to set the size of html textarea

Recommended tutorial: "html video tutorial"

The above is the detailed content of How to set the size of html textarea. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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