HTML Tutorials

Multiline text boxes

If a single-line text field doesn’t offer enough room for a response, create a text box instead of a text field:

  • The <textarea> element defines the box and its parameters.
  • The rows attribute specifies the height of the box in rows based on the font in the text box.
  • The cols attribute specifies the width of the box in columns based on the font in the text box.

The text that the user types into the box provides the value, so you need only give the box a name with the name attribute:

<!DOCTYPE html>
<html lang="en">
    <form method="post">
      <p> Please include any comments here.</p>
      <textarea rows="10" cols="40" name="comments">
      ...comments here...

Please include any comments here.

Any text you include between the <textarea> and </textarea> tags appears in the text box in the browser. The user then enters information in the text box and overwrites your text.