번역 작업 진행중입니다.

CSS.supports() 메서드는 주어진 CSS 기능을 지원하는지 여부를 Boolean 값으로 반환합니다.

구문

CSS.supports(propertyName, value);
CSS.supports(supportCondition);

매개변수

There are two distinct sets of parameters. The first one allows to test the support of a pair property-value:

propertyName
A DOMString containing the name of the CSS property to check.
value
A DOMString containing the value of the CSS property to check.

The second syntax takes one parameter matching the condition of @supports:

supportCondition
A DOMString containing the condition to check.

반환 값

true if the browser supports the rule, otherwise false.

예제

result = CSS.supports("text-decoration-style", "blink");
result = CSS.supports("display: flex");
result = CSS.supports("(--foo: red)");

result = CSS.supports(`(transform-style: preserve) or (-moz-transform-style: preserve) or
                       (-o-transform-style: preserve) or (-webkit-transform-style: preserve)`);

// result is true or false

명세

Specification Status Comment
CSS Conditional Rules Module Level 3
The definition of 'CSS: supports()' in that specification.
Candidate Recommendation Initial definition.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
supportsChrome Full support 61
Full support 61
Partial support 28
Notes
Notes Version 60 or older didn't support parentheses-less one-argument version.
Edge Partial support 12
Notes
Partial support 12
Notes
Notes Edge doesn't support parentheses-less one-argument version.
Firefox Full support 55
Full support 55
Partial support 22
Notes
Notes Version 54 or older didn't support parentheses-less one-argument version.
Partial support 20
Disabled
Disabled From version 20: this feature is behind the layout.css.supports-rule.enabled preference. To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 12.1Safari Full support 9WebView Android Full support 61
Full support 61
Partial support 37
Notes
Notes Version 60 or older didn't support parentheses-less one-argument version.
Chrome Android Full support 61
Full support 61
Partial support 28
Notes
Notes Version 60 or older didn't support parentheses-less one-argument version.
Edge Mobile Partial support Partial
Notes
Partial support Partial
Notes
Notes Edge doesn't support parentheses-less one-argument version.
Firefox Android Full support 55
Full support 55
Partial support 22
Notes
Notes Version 54 or older didn't support parentheses-less one-argument version.
Partial support 20
Disabled
Disabled From version 20: this feature is behind the layout.css.supports-rule.enabled preference. To change preferences in Firefox, visit about:config.
Opera Android Full support 12.1Safari iOS Full support 9Samsung Internet Android Full support 4.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.

같이 보기

문서 태그 및 공헌자

이 페이지의 공헌자: mdnwebdocs-bot, alattalatta
최종 변경자: mdnwebdocs-bot,