The University of Texas at Austin- What Starts Here Changes the World
Services Navigation

Text Boxes

Text boxes are used to gather lengthy or multiple-line text responses from a user.

Text boxes are created using the <textarea></textarea> tag. The TEXTAREA tag has three required attributes NAME, ROWS, and COLS, and one attribute that works only in Netscape, WRAP.

Sample HTML source for a text box:

<textarea name="comments" rows="10" cols="50" wrap="physical"> Default Text

See the table below for more examples of text boxes.

The NAME Attribute (required)

The author of the form assigns a value to the NAME attribute. Choose names for your form fields which are meaningful.

The ROWS Attribute (required)

The ROWS attribute specifies the height, in rows of text, of the text box.

The COLS Attribute (required)

The COLS attribute specifies the width, in characters, of the text box.

The ID Attribute (optional, but required by accessibility standards)

The ID attribute is used to explicitly associate the specific Input tag with a specific LABEL tag. ID attributes are unique within a page.


HTML Source

<label for = "textarea">Example Text Box:<br />
<textarea name="textarea" id="textarea" cols="25" "rows=5">

Note:The <textarea> tag is a container tag. Text enclosed in this container is the default text, and will be transmitted to the CGI script as the value of the text box.

  Updated 2009 July 10
  Copyright | Privacy | Accessibility
  Contact Us