Information about cookies on this page

Our website uses cookies to ensure the functionality of the website, to collect and analyze information about the performance and usage of the website. Privacy Policy

  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in
  
  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in

Longer Text

A text input has only one line, which is too little for a longer message. For text that can have several lines, we use the textarea element (a text area).

Unlike input, textarea has a closing tag. Whatever we write between the tags appears in the box as pre-filled text, so for an empty box, we write the closing tag right after the opening one. The rows attribute sets how many lines of text the box shows; the user can still write more.

<label for="input-message">Message</label>
<textarea name="message" id="input-message" rows="3"></textarea>

This code is displayed like this:

Instructions

  1. 1

    In the empty div, create a textarea element with the attribute name with the value about and the attribute id with the value input-about.

  2. 2

    Add the attribute rows with the value 4 to the textarea, so that the box shows four lines.

  3. 3

    Before the textarea, create a label with the content About me and the attribute for with the value input-about.

Back

8/11

  1. 1. The Form Element
  2. 2. Text Input
  3. 3. Input Label
  4. 4. Password Input
  5. 5. More Input Types
  6. 6. Radio Buttons and Checkboxes
  7. 7. Drop-down List
  8. 8. Longer Text
  9. 9. Form Submission
  10. 10. Required Input
  11. 11. Form Summary
Next

Try it yourself

Do this exercise right here in your browser. No account needed.