AI Workshop: learn to build apps with AI →
More CSS Topics: CSS Feature Queries

Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.


Feature queries are a recent and relatively unknown ability of CSS, but a well supported one.

We can use it to check if a feature is supported by the browser using the @supports keyword.

This is an example that I think is especially useful, at the time of writing, for checking if a browser supports CSS Grid, which can be done using:

@supports (display: grid) {
  /* apply this CSS */
}

We check if the browser supports the grid value for the display property.

We can use @supports for any CSS property, to check any value.

We can also use the logical operators and, or and not to build complex feature queries.

This example checks if the browser supports both CSS Grid and Flexbox:

@supports (display: grid) and (display: flex) {
  /* apply this CSS */
}

Lessons in this unit:

0: Introduction
1: CSS Variables (Custom Properties)
2: Importing a CSS file using @import
3: CSS Inheritance
4: CSS Comments
5: CSS Normalizing
6: The CSS z-index property
7: The CSS float property and clearing
8: ▶︎ CSS Feature Queries
9: How to print your HTML with style
10: CSS Vendor Prefixes
11: How to style lists using CSS
12: Styling HTML Tables with CSS
13: CSS Error Handling
14: Introduction to PostCSS