user-select

CSS user-select 속성은 사용자가 텍스트를 선택할 수 있는지 지정합니다.

/* 키워드 값 */
user-select: none;
user-select: auto;
user-select: text;
user-select: contain;
user-select: all;

/* 전역 값 */
user-select: inherit;
user-select: initial;
user-select: unset;

구문

none
이 요소와 아래 요소의 텍스트를 선택하지 못하도록 막습니다. 단 Selection 객체는 none인 요소(와 그 아래)를 포함할 수 있습니다.
auto

auto의 사용값은 아래와 같이 결정됩니다.

  • ::before::after 의사 요소의 사용값은 none입니다.
  • 편집 가능한 요소의 사용값은 contain입니다.
  • 그렇지 않고, 부모 요소 user-select의 사용값이 all이면 이 요소의 사용값도 all입니다.
  • 그렇지 않고, 부모 요소 user-select의 사용값이 none이면 이 요소의 사용값도 none입니다.
  • 그렇지 않으면 사용값은 text입니다.
text
사용자가 텍스트를 선택할 수 있습니다.
all
요소의 콘텐츠가 원자적으로 선택됩니다. 즉 선택 범위는 이 요소와 그 아래의 자손 전체를 포함해야 하며 일부만 담을 수는 없습니다. 하위 요소에서 더블 클릭이나 콘텍스트 클릭이 발생한 경우, all을 지정한 조상 요소 중 제일 상위 요소를 선택합니다.
contain
선택의 시작을 이 요소 안에서 한 경우, 범위가 요소 바깥으로 벗어날 수 없습니다.

형식 정의

초기값auto
적용대상all elements
상속no
Computed valueas specified
Animation typediscrete

형식 구문

auto | text | none | contain | all

예제

HTML

<p>You should be able to select this text.</p>
<p class="unselectable">Hey, you can't select this text!</p>
<p class="all">Clicking once will select all of this text.</p>

CSS

.unselectable {
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.all {
  -moz-user-select: all;
  -webkit-user-select: all;
  -ms-user-select: all;
  user-select: all;
}

결과

명세

Specification Status Comment
CSS Basic User Interface Module Level 4
The definition of 'user-select' in that specification.
Working Draft Initial definition. Also defines -webkit-user-select as a deprecated alias of user-select.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
user-selectChrome Full support 54
Full support 54
Full support 1
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Edge Full support 12
Prefixed
Full support 12
Prefixed
Prefixed Implemented with the vendor prefix: -ms-
Full support 12
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Firefox Full support 69
Full support 69
Full support 49
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Full support 1
Prefixed
Prefixed Implemented with the vendor prefix: -moz-
Full support 44
Prefixed Disabled
Prefixed Implemented with the vendor prefix: -webkit-
Disabled From version 44: this feature is behind the layout.css.prefixes.webkit preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE Full support 10
Prefixed
Full support 10
Prefixed
Prefixed Implemented with the vendor prefix: -ms-
Opera Full support 15
Prefixed
Full support 15
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Safari Full support 3
Prefixed
Full support 3
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
No support 2 — 3
Prefixed
Prefixed Implemented with the vendor prefix: -khtml-
WebView Android Full support 54
Full support 54
Full support ≤37
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Chrome Android Full support 54
Full support 54
Full support 18
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Firefox Android Full support 49
Prefixed
Full support 49
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Full support 4
Prefixed
Prefixed Implemented with the vendor prefix: -moz-
Full support 44
Prefixed Disabled
Prefixed Implemented with the vendor prefix: -webkit-
Disabled From version 44: this feature is behind the layout.css.prefixes.webkit preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android Full support 14
Prefixed
Full support 14
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Safari iOS Full support 3
Prefixed
Full support 3
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Samsung Internet Android Full support 6.0
Full support 6.0
Full support 1.0
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
allChrome Full support 53Edge Full support 79Firefox Full support 1IE No support NoOpera Full support 40Safari No support NoWebView Android Full support 53Chrome Android Full support 53Firefox Android Full support 4Opera Android Full support 41Safari iOS No support NoSamsung Internet Android Full support 6.0
autoChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 10Opera Full support 15Safari Full support 2WebView Android Full support ≤37Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 14Safari iOS Full support 3Samsung Internet Android Full support 1.0
containChrome No support NoEdge No support 12 — 79
Alternate Name
No support 12 — 79
Alternate Name
Alternate Name Uses the non-standard name: element
Firefox No support NoIE Full support 10
Alternate Name
Full support 10
Alternate Name
Alternate Name Uses the non-standard name: element
Opera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
noneChrome Full support 1Edge Full support 12Firefox Full support 21
Full support 21
No support 1 — 65
Prefixed
Prefixed Implemented with the vendor prefix: -moz-
IE Full support 10Opera Full support 15Safari Full support 2WebView Android Full support ≤37Chrome Android Full support 18Firefox Android Full support 21
Full support 21
No support 4 — 65
Prefixed
Prefixed Implemented with the vendor prefix: -moz-
Opera Android Full support 14Safari iOS Full support 3Samsung Internet Android Full support 1.0
textChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 10Opera Full support 15Safari Partial support 2
Notes
Partial support 2
Notes
Notes Allows typing in the <html> container.
WebView Android Full support ≤37Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 14Safari iOS Partial support 3
Notes
Partial support 3
Notes
Notes Allows typing in the <html> container.
Samsung Internet Android Full support 1.0

Legend

Full support  
Full support
Partial support  
Partial support
No support  
No support
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.
Uses a non-standard name.
Uses a non-standard name.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

같이 보기