현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.
개요
The HTML select (<select>) element represents a control that presents a menu of options. The options within the menu are represented by elements, which can be grouped by <option> elements. Options can be pre-selected for the user.<optgroup>
사용 문맥
| 콘텐츠 범주 | flow content, phrasing content, interactive content, listed, labelable, resettable, and submittable form-associated element |
| 허용되는 콘텐츠 | Zero or more <option> or <optgroup> elements. |
| 태그 생략 | none, both the start tag and the end tag are mandatory |
| 허용되는 부모 요소 | any element that accepts phrasing content |
속성
This element includes the global attributes.
autofocusHTML5- This attribute lets you specify that a form control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form element in a document can have the
autofocusattribute, which is a Boolean. disabled- This Boolean attribute indicates that the user cannot interact with the control. If this attribute is not specified, the control inherits its setting from the containing element, for example
fieldset; if there is no containing element with thedisabledattribute set, then the control is enabled. formHTML5- The form element that the select element is associated with (its "form owner"). If this attribute is specified, its value must be the ID of a form element in the same document. This enables you to place select elements anywhere within a document, not just as descendants of their form elements.
multiple- This Boolean attribute indicates that multiple options can be selected in the list. If it is not specified, then only one option can be selected at a time.
name- The name of the control.
requiredHTML5- A Boolean attribute indicating that an option with a non-empty string value must be selected.
size- If the control is presented as a scrolled list box, this attribute represents the number of rows in the list that should be visible at one time. Browsers are not required to present a select elements as a scrolled list box. The default value is 0.
DOM 인터페이스
This element implements the HTMLSelectElement interface.
예제
<!-- The second value will be selected initially --> <select name="select"> <option value="value1">Value 1</option> <option value="value2" selected>Value 2</option> <option value="value3">Value 3</option> </select>
결과
참고
The content of this element is static and not editable.
The following is an example of how to simulate a select list with editable options, but be warned that screen readers and assistive devices will not interpret the form correctly; this example would be invalid html if the correct elements were used:
This is an example of an editable select through a <fieldset> of radioboxes and textboxes (written in pure CSS, without JavaScript),
사양
| 사양 | 상태 | 주석 |
|---|---|---|
| HTML5 The definition of '<select>' in that specification. |
Recommendation | |
| HTML 4.01 Specification The definition of '<select>' in that specification. |
Recommendation |
브라우저 호환성
| 기능 | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 1.0 | 1.0 (1.7 or earlier) | (Yes) | (Yes) | (Yes) |
required 속성 |
(Yes) | 4.0 (2.0) | 10 | (Yes) | (Yes) |
| 기능 | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | (Yes) [1] | 1.0 (1.0) [2] | (Yes) | (Yes) | (Yes) |
required 속성 |
(Yes) | 4.0 (2.0) | Not supported | (Yes) | (Yes) |
[1] In the Browser app for Android 4.1 (and possibly later versions), there is a bug where the menu indicator triangle on the side of a <select> will not be displayed if a background, border, or border-radius style is applied to the <select>.
[2] Firefox for Android, by default, sets a background-image gradient on all <select multiple> elements. This can be disabled using background-image: none.
Chrome and Safari both ignore border-radius on <select> elements unless -webkit-appearance is overridden to an appropriate value.
같이 보기
- Other form-related elements:
<form>,<legend>,<label>,<button>,<option>,<datalist>,<optgroup>,<fieldset>,<textarea>,<keygen>,<input>,<output>,<progress>and<meter>.

