HTML and CSS Reference
In-Depth Information
Figures 8-20.
The control in Firefox (left) and Chrome (right), both on OS X. The menus appear quite different, but both
browsers do make the group labels clearly distinguishable from the options beneath them.
Required Attributes
label
: Specifies a text label or title for the option group, usually displayed in some distinctive
style to set it apart from the selectable options.
Optional Attributes
disabled
: A Boolean attribute that, when present, disables the entire group so none of its
options can be selected. Most browsers will display disabled options in a “grayed-out” style, and
may gray out the group label as well.
textarea
The
textarea
element creates a multi-line field for entering passages of text too lengthy for a single-line
text field (
input type="text"
). You can define its rendered size with CSS, or with the optional
rows
and
cols
attributes; the value of
rows
is the vertical number of text rows and
cols
is the number of characters
(or columns, hence the shortened name,
cols
) on a horizontal line. Left to its own devices, most browsers
will display a
textarea
as a white box, two or three rows tall and about 20 columns wide.
Because the size of the box is based on the size of the text, a larger or smaller font size will obviously
influence the dimensions of the
textarea
element. If the
rows
and
cols
attributes are present, CSS can
still override them and apply a different width or height. Vertical and horizontal scroll bars will appear if the
amount of text entered into a
textarea
exceeds what can fit within its given dimensions.
This is a non-empty element that requires an end tag. It can contain only text—no HTML allowed—that will
be displayed as the control's initial value, and a user can easily delete or edit that initial text. Any initial text
within the
textarea
element will be displayed with all whitespace intact, including tabs and returns,