Modern CSS for CSSs
Modern CSS refers to newer features that remove the need for preprocessors and JavaScript workarounds. Custom properties hold reusable values, and features like container queries, the :has selector, nesting, cascade layers and logical properties give finer control. Browser support differs, so check before relying on a feature.
Stage: Motion and Effects · Part of the CSS roadmap · Last reviewed 19 November 2026
What to learn in Modern CSS
- Define and use custom properties with var() and fallbacks
- Write a container query so a component adapts to its parent width
- Select a parent that contains a given child using :has
- Use native CSS nesting to group related rules
- Check browser support with a compatibility table before adopting a feature
Modern CSS interview questions
How do CSS custom properties differ from Sass variables?
Sass variables are replaced at build time and cannot change in the browser. CSS custom properties are live values that follow the cascade, can be changed with JavaScript or by media queries, and enable features like theming and dark mode.
What is a container query?
A container query applies styles based on the size of a containing element instead of the viewport. This lets a card or widget adapt wherever it is placed, in a sidebar or a main column, which media queries cannot do.
Where Modern CSS fits in the CSS roadmap
Modern CSS belongs to the Motion and Effects stage (beginner level), which takes about 13 hours. Bring it to life.