Articles Tagged
@supports
The @supports at-rule tests whether a browser supports a CSS feature and allows developers to provide fallback styles if it doesn’t, in what’s commonly called a feature query.
@supports (display: grid) {
main {
display: grid;
}
}… “Evergreen” Does Not Mean Immediately Available
I have a coworker who is smart, capable, and technologically-literate. Like me, they work on the web full-time.
When they are sharing their screen in a meeting, I find myself disassociating fixating on the red update button in their copy …
@supports selector()
I didn’t realize the support for @supports determining selector support was so good! I usually think of @supports as a way to test for property: value pair support. But with the selector() function, we can test for selector support …
Detecting Media Query Support in CSS and JavaScript
You can’t just do @media (prefers-reduced-data: no-preference) alone because, as Kilian Valkhof says:
…[…] that would be false if either there was no support (since the browser wouldn’t understand the media query) or if it was supported but the
Custom Styling Form Inputs With Modern CSS Features
It’s entirely possible to build custom checkboxes, radio buttons, and toggle switches these days, while staying semantic and accessible. We don’t even need a single line of JavaScript or extra HTML elements! It’s actually gotten easier lately than it has …
Can you nest @media and @support queries?
Yes, you can, and it doesn’t really matter in what order. A CSS preprocessor is not required. It works in regular CSS.
This works:
@supports(--a: b) {
@media (min-width: 1px) {
body {
background: red;
}
}
}
And so …
Get a CSS Custom Property Value with JavaScript
Here’s a neat trick from Andy Bell where he uses CSS Custom Properties to check if a particular CSS feature is supported by using JavaScript.
Basically, he’s using the ability CSS has to check for browser support on a particular …
How @supports Works
CSS has a neat feature that allows us to test if the browser supports a particular property or property:value combination before applying a block of styles — like how a @media query matches when, say, the width of the browser …