Modern CSS 2025 & Summary
The newest CSS features and the key takeaways for writing modern, maintainable stylesheets.
Modern CSS 2025
| Feature | What it does |
|---|---|
| CSS Nesting | Native nesting — no Sass needed |
| Container Queries | Respond to the parent container's width |
:has() | The long-awaited parent selector |
| CSS Cascade Layers | @layer for managing specificity |
| Scroll-driven animations | Zero JavaScript |
| CSS Custom Properties | Design tokens |
oklch() | Wide-gamut perceptual colour |
text-wrap: balance | Smart headings |
Key Takeaways
- Separate style from content — use external CSS.
box-sizing: border-box— always reset it globally.- Use
rem/emoverpxfor scalable layouts. - Flexbox for 1D layouts, Grid for 2D layouts.
animation-fill-mode: bothfor smooth entry/exit.steps()for sprite-sheet frame control.- Mobile-first with
min-widthmedia queries. - Validate at
jigsaw.w3.org/css-validator.
Activity — complete the code
Complete the code correctly to mark this lesson as complete automatically.
Complete the three modern CSS 2025 features.
/* Parent selector */div:(img) { border: 1px solid; }/* Cascade layers */@ reset, base, components;/* Smart headings */h1 { text-wrap: ; }