w3resource

HTML5: How to define a multiline input control text area?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Define document type as HTML -->
<html><!-- Begin HTML document -->
<head><!-- Start of document header -->
<meta charset="utf-8"><!-- Define character encoding -->
<title>How to define a multiline input control text area</title><!-- Title of the HTML page -->
</head><!-- End of document header -->
<body><!-- Start of document body -->
<textarea rows="4" cols="40"><!-- Textarea element with rows and columns attributes -->
w3resource is a free, open-source <!-- Text content inside the textarea -->
tutorial.you will learn with HTML5 
tutorial of w3resource.
</textarea><!-- End of textarea -->
</body><!-- End of document body -->
</html><!-- End of HTML document -->

Explanation:

  • This HTML code defines a webpage with a textarea element.
  • The <textarea> tag creates a multiline text input control.
  • The rows="4" attribute specifies that the textarea should display 4 rows.
  • The cols="40" attribute specifies that the textarea should display 40 columns.
  • The text content inside the textarea is displayed as the initial value.
  • Users can input or edit text within the textarea, and it can accommodate multiple lines of text.

Live Demo:

See the Pen textarea-answer by w3resource (@w3resource) on CodePen.


See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo
Yes Yes Yes Yes Yes

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/html-css-exercise/basic/textarea-answer.php