Creating Larger Text Areas

In some cases, you want to give the visitor more room to write. Unlike text boxes (see page 262), text areas may be as large as your page, and will expand as needed if the person enters more text than can fit in the display area. They're perfect for eliciting questions and comments.

Figure 17.34. The value attribute is not used with the textarea tag. Default values are set by adding text between the opening and closing tags (as in "Please share..." shown here).

To create larger text areas:


If desired, type the explanatory text that will identify the text area.


Type <textarea.


Type name="label", where label is the text that will identify the input data to the server (and your script).


Type rows="n", where n is the height of the text area in rows.


Type cols="n", where n is the width of the text area in characters.


Type >.


Type the default text, if any, for the text area. No formatting is allowed here.


Type </textarea> to complete the text area.

Figure 17.35. For some reason, I had to apply the font property directly to the textarea element to get it to take hold. It did not inherit from the body.

Figure 17.36. The visitor can override the default text simply by typing over it.


  • There is no use for the value attribute with text areas.

  • Visitors can enter up to 32,700 characters in a text area. Scroll bars will appear when necessary.

  • Both the rows and cols attributes are required.

HTML, XHTML, & CSS(c) Visual QuickStart Guide
HTML, XHTML, and CSS, Sixth Edition
ISBN: 0321430840
EAN: 2147483647
Year: 2004
Pages: 340

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: