MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

<optgroup>

현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.

개요

In a Web form, the HTML <optgroup> element  creates a grouping of options within a <select> element.

  • 콘텐츠 카테고리 None.
  • 허용되는 콘텐츠 Zero or more <option> elements.
  • 태그 생략 The start tag is mandatory. The end tag is optional if this element is immediately followed by another <optgroup> element, or if the parent element has no more content.
  • 허용되는 부모 요소 A <select> element.
  • DOM 인터페이스 HTMLOptGroupElement

주의: Optgroup elements may not be nested.

속성

This element includes the global attributes.

disabled
If this Boolean attribute is set, none of the items in this option group is selectable. Often browsers grey out such control and it won't receive any browsing events, like mouse clicks or focus-related ones.
label
The name of the group of options, which the browser can use when labeling the options in the user interface. This attribute is mandatory if this element is used.

예제

<select>
  <optgroup label="Group 1">
    <option>Option 1.1</option>
  </optgroup> 
  <optgroup label="Group 2">
    <option>Option 2.1</option>
    <option>Option 2.2</option>
  </optgroup>
  <optgroup label="Group 3" disabled>
    <option>Option 3.1</option>
    <option>Option 3.2</option>
    <option>Option 3.3</option>
  </optgroup>
</select>

결과

사양

사양 상태 주석
WHATWG HTML Living Standard
The definition of '<optgroup>' in that specification.
Living Standard  
HTML5
The definition of '<optgroup>' in that specification.
Recommendation  
HTML 4.01 Specification
The definition of '<optgroup>' in that specification.
Recommendation  

브라우저 호환성

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 (Yes) (Yes) (Yes) (Yes)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)

같이 보기

문서 태그 및 공헌자

 이 페이지의 공헌자: azunyan3
 최종 변경: azunyan3,