The SELECT element

Permitted Context: %Body.Content but must be within FORM
Content Model: one ore more OPTION elements

The SELECT element is used for single and multiple choice menus. It is generally rendered as a drop-down or pop-up menu, and offers a more compact alternative to using radio buttons for single choice menus, or checkboxes for multiple choice menus.


<SELECT NAME="flavor">
<OPTION>Rum and Raisin
<OPTION>Peach and Orange

This is a single choice menu. When you want a multiple choice menu, you need to include the MULTIPLE attribute with the SELECT element, e.g. <SELECT MULTIPLE NAME="flavor">.

The NAME attribute is used when creating the name/value list describing the form's contents. A name/value pair is contributed for each selected option. The value is taken from the OPTION's VALUE attribute, and defaults to the content of the OPTION when the VALUE attribute is missing.

For single choice menus, if no option is initially marked as selected, then the first item listed is selected. This is inappropriate for multiple choice menus, though.

Graphical Menus

HTML 3.0 extends the SELECT element to support graphical menus. This is allows you to specify an image for the SELECT element, and hotzones for each of the OPTION elements. In this way the same menu can be rendered as a conventional text-based menu for non-graphical user agents and a graphical menu for graphical user agents.

The image is specified in the same way as for IMG elements. This means you can specify suggested values for the width and height. You can also float the image to the left or right margins and flow other elements around it. The hotzones for OPTION elements are specified using the SHAPE attribute in the same way as for anchor elements.

Permitted Attributes

An SGML identifier used as the target for hypertext links or for naming particular elements in associated style sheets. Identifiers are NAME tokens and must be unique within the scope of the current document.
This is one of the ISO standard language abbreviations, e.g. "" for the variation of English spoken in the United Kingdom. It can be used by parsers to select language specific choices for quotation marks, ligatures and hypenation rules etc. The language attribute is composed from the two letter language code from ISO 639, optionally followed by a period and a two letter country code from ISO 3166.
This a space separated list of SGML NAME tokens and is used to subclass tag names. By convention, the class names are interpreted hierarchically, with the most general class on the left and the most specific on the right, where classes are separated by a period. The CLASS attribute is most commonly used to attach a different style to some element, but it is recommended that where practical class names should be picked on the basis of the element's semantics, as this will permit other uses, such as restricting search through documents by matching on element class names. The conventions for choosing class names are outside the scope of this specification.
The formal name of the menu which is used in the form's contents list.
The presence of this attribute denotes that the SELECT element defines a multiple choice menu. In its absence, the element defines a single choice menu.
When present, the menu should be rendered as normal, but can't be modified by the user. Where practical the rendering should provide a cue that the menu is disabled e.g. by graying out the text, changing the color of the background or similar.
This attribute specifies an error message explaining why the menu's current selections are incorrect. Further error messages can be attached to individual options. When this attribute is missing, the menu can be assumed to be ok. User agents are recommended to provide a cue to indicate that the menu is in error.
SRC (Source)
The SRC attribute is used for graphical menus to specify the URI for the image. Its syntax is the same as that of the HREF attribute of the <A> tag.
Specifies a message digest or cryptographic checksum for the associated image specified by the SRC attribute. It is used when you want to be sure that the image is indeed the same one that the author intended, and hasn't been modified in any way. For instance, MD="md5:jV2OfH+nnXHU8bnkPAad/mSQlTDZ", which specifies an MD5 checksum encoded as a base64 character string. The MD attribute is generally allowed for all elements which support URI based links.
Optional suggested width for the image. By default, this is given in pixels.
Optional suggested height for the image. By default, this is given in pixels.
This optional attribute specifies the units for the width and height attributes. It is one of: units=pixels (the default) or units=em (the width of the letter "m") which scales with the font size.
Take values TOP or MIDDLE or BOTTOM, defining whether the top or middle or bottom of the graphic should be aligned with the baseline for the text line in which the IMG element appears.

With ALIGN=LEFT, the graphic will float down and over to the current left margin, and subsequent text will wrap around the right hand side of the graphic. Likewise for ALIGN=RIGHT, the graphic aligns with the current right margin and, and text wraps around the left.