From the course: HTML and CSS: Creating Forms

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Textarea element

Textarea element

- [Instructor] The textarea element is similar to the text input type in that any characters can be entered. The difference is that a textarea element can collect text that takes up several lines and allows the user to hint the Enter key to start a new line while they're typing in the text area. For this one, I'm going to ask the user to write a poem since that's something that takes up several lines. So I'm going to start with a paragraph tag, and then inside that, put textarea, give it an id of poem and a name of poem. And then the closing textarea. And then below that, label for poem. And the question or the instructions will be write a poem and then the closing label tag. One thing to note for the textarea element is that you need an opening and closing tag, even if there's nothing in between them. So back in the browser, I'm going to refresh and you see it's not just a one-line box like I got for inputs. I can type in there and hit Enter, and it lets me keep typing more text. If…

Contents