HTML5: How to define a multiline input control text area?
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
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics