Feature Detection in CSS (CSS @supports)
8/28/16About 2 minCSSArticle(s)blogbram.uscss
Feature Detection in CSS (CSS @supports) ź“ė Ø
TypeScript > Article(s)
Article(s)
Feature Detection in CSS (CSS @supports)
Thereās a good introduction to @supports on Mozilla Hacks: With @supports, you can write a small test in your CSS to see whether or not a particular āfeatureā (CSS property or value) is supported, and apply a block of code (or not) based on the answer. Progressive enhancement in itās finest form: /* fallback code ⦠Continue reading āFeature Detection in CSS (CSS @supports)ā

Thereās a good introduction to @supports on Mozilla Hacks:
With
@supports, you can write a small test in your CSS to see whether or not a particular āfeatureā (CSS property or value) is supported, and apply a block of code (or not) based on the answer.
Progressive enhancement in itās finest form:
/* fallback code for older browsers */
@supports (display: grid) {
/* code for newer browsers */
/* including overrides of the code above, if needed */
}
Apart from enhancing your styles, you could also use to show/hide warnings. The trick is to show a warning by default, and then hide it
.warning {
/* style for warning box here ā¦*/
}
@supports (display: grid) {
/* hide warning box */
.warning {
display: none;
}
/* extra styles here ⦠*/
}
Handy when making tech-demos.
What about browser support?
Feature Queries have been around since midā2013. With the imminent release of Safari 10, I believe itās past time for us to add @supports to our toolbox.
Using Feature Queries in CSS ā Mozilla Hacks - the Web developer blog
Thereās a tool in CSS that you might not have heard of yet. Itās powerful. Itās been there for a while. And itāll likely become one of your favorite new ...
Feature Detection in CSS (CSS @supports)
Thereās a good introduction to @supports on Mozilla Hacks: With @supports, you can write a small test in your CSS to see whether or not a particular āfeatureā (CSS property or value) is supported, and apply a block of code (or not) based on the answer. Progressive enhancement in itās finest form: /* fallback code ⦠Continue reading āFeature Detection in CSS (CSS @supports)ā