Textarea in html

In this article we are going to learn about textarea in html, how to create textareas for users to fill unlimited number of characters.

We learnt about html in general, learning the structure of hypertext markup language, text in html, lists in html, links in html, inputs in html, buttons in html, forms in html, html elements, tables in html, marquee in html and horizontal line in html so, now we are going to learn about textarea in html.

Textarea

Textarea is used in html forms to hold unlimited number of characters and can be customized with size by using cols and rows attributes.

Default textarea

Default textarea has unlimited size, it can be auto increased to a required size by dragging on the bottom right corner of it.

Let us create a default textarea, copy and paste below code.

<!DOCTYPE html>

<body>

<textarea></textarea>

</body>

</html>


So, we should have the following results and this default textarea can be increased to unlimited size.


Textarea width

Textarea width can be customized and specifies the width of the textarea width by using cols attribute.

Let us create textarea with a width specified, copy and paste below code.

<!DOCTYPE html>

<body>

<textarea cols="6"></textarea>

</body>

</html>


So, we should have the following results and textarea width has decreased and can still be resized to unlimited height.


Textarea height

Textarea height can be customized and specifies the height of the textarea height by using rows attribute.

Let us create textarea with a height specified, copy and paste below code.

<!DOCTYPE html>

<body>

<textarea rows="6"></textarea>

</body>

</html>


So, we should have the following results and textarea height has increased and can still be resized to unlimited height.


Let us sum up by creating more than one textareas with different sizes of width and height specified, copy and paste below code.

<!DOCTYPE html>

<body>

<textarea cols="6" rows="6"></textarea>

<textarea cols="10" rows="4"></textarea>

<textarea cols="8" rows="3"></textarea>

</body>

</html>


So, we should have the following results and there are three textareas with different width and height and can still be resized to unlimited height.


Conclusion

In this article we learnt about textarea in html with examples, how to create textareas for users to fill unlimited number of characters.