Text Area Forms multi line data input

Text Area in HTML Forms for multiline data input:

Text Area Forms multi line data input: Occasionally, we are required to seek user input in the form of detailed note or paragraphs. This becomes tricky because with the single line input tag lengthy arguments and text cannot be obtained from users. The tag <textarea></textarea> allows the user to input multiline data into html forms. A ‘textarea’ tag has a few attributes which include: rows and heights. Rows in ‘textarea’ define height while cols represent width of the text area box.

A text area looks like this: 

 

A sample code for textarea is shared below for a better understanding:

Sample Code for TextArea

<label>

            A Textarea looks like this:

          </label>

        </p>

        <p>

          <textarea id = “txtAnswer”

                    rows = “15”

                    cols = “30”></textarea>

        </p>

 

  1. <label></label> is meant for the text that appears before the textarea
  2. We have wrapped <label> tag inside a paragraph<p> element.  This is to separate it from the <textarea> box.
  3. We have also contained the <textarea> itself into a <p> paragraph.
  4. There is an id added to the text area.
  5. Rows are for the height whereas cols stand for width of the visible <textarea> box to the user.

Leave a Reply