9.9 Text Area

The <textarea> tag is a very useful tag for use in forms because it defines a multiple line text input area for visitors to enter comments or whatever. The size of a text area can be specified by using two more useful attributes called col and row. For example:

<form>
<textarea rows="10" cols="30">
Comments Welcome!
</textarea>
</form>

This would look like this in a browser:

Fieldset

Before leaving forms it is worth mentioning another tag. The <fieldset> tag is used to logically group together elements in a form. It also draws a box around the related form elements. It is normally used in conjunction with the <legend> tag, from which it derives its content. For example:

<fieldset>
<legend>
Health information:
</legend>
<form>
Height <input type="text" size="3">
Weight <input type="text" size="3">
</form>
</fieldset>

This would look like this in a browser:

Health information:
Height Weight

The label tag sets a caption that is displayed inside a border.