multiple (HTML attribute)

Spec
Depr. Version
No HTML 3.02
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

multiple="multiple"

Description

When the multiple attribute is combined with the size attribute, the user is able to select multiple, noncontiguous items from the list of options. To do this, the user must use a modifier key; for most Windows browsers, users would press Control while they clicked, while users of Mac browsers would press Command while they clicked. The user’s selection may appear as shown in Figure 1—this screenshot was taken using Firefox on Mac, but the highlight colour may vary depending on user preferences.

Figure 1. Selecting multiple items Multiple items selected

Note that in the example shown, there is no formatting in the form of CSS, or br or div elements, so the label text appears to be aligned with the base of the select element. Naturally, you’d want to rectify this, but I’ve presented it this way so that you’re aware of the default layout.

Multiple select lists aren’t very common, and it may be better to provide such choices in the form of checkboxes. If you use a multiple select list, you’ll almost always need to provide instructions to tell the user how to select multiple items—and those instructions will need to be relevant to the browsers and operating systems in use, which ultimately means there’s more room for user error.

Example

This example shows a multiple attribute applied to a select list:
<form>
  <label for="favoritefood">Favorite food</label>
  <select name="favoritefood" id="favoritefood"
      multiple="multiple" size="10">
    <option>Cheese</option>
    <option>Egg</option>
    <option>Cabbage</option>
    ⋮
  </select>
</form>

Value

The only possible value for this attribute is "multiple".

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

It causes no compatibility issues, and has excellent support across all tested browsers.

User-contributed notes

Related Products