webdevlinux - logo Web Dev Linux

Textarea

In HTML forms, the textarea element is used to define a multi-line text area like an address, description etc..

HTML textarea textarea

Try the below example to understand how to use the textarea element inside an HTML document. In this case, we have used a table to make the form structure.

FILE : textarea.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Textarea</title>
</head>
<body>
<form>
	<table>
		<tr>
			<th>Your Address</th>
			<td><textarea></textarea></td>		
		</tr>
		<tr>
			<th>Describe Yourself</th>
			<td><textarea cols="40" rows="10"></textarea></td>		
		</tr>
	</table>
</form>
</body>
</html>

Explanation

Take a look at the explanation of elements & attributes used in the example.

<textarea></textarea>
The textarea element represents a multi-line text input field.
cols="40"
The cols attribute represents the maximum numbers of characters per line. When the cols attribute is not specified then the default cols value of the textarea is 20.
rows="10"
The rows attribute represents the maximum numbers of lines to display. When the rows attribute is not specified then the default cols value of the textarea is 2.

The size of textarea is also adjustable on the latest browsers.