CSS is growing fast, and 2025 is already full of awesome features that work in all major browsers. If you're into writing clean, modern, and powerful styles, these updates will make your day.
1. Scrollbar Gutter & Scrollbar Color
Usually, when scrollbars appear, your layout might jump. But with scrollbar-gutter
, you can avoid that by reserving the space ahead of time.
.scrollable {
scrollbar-gutter: stable both-edges;
}
To match your design better, you can also color the scrollbar:
.scrollable {
scrollbar-color: #444 #ccc;
}
✅ Why it's great
- Keeps layouts stable even before scrolling.
- Lets you style scrollbars to fit your theme.
2. ::target-text
Want users to spot the exact line a link jumped to? ::target-text
highlights the specific text targeted by an anchor link.
::target-text {
background: yellow;
color: black;
}
✅ Why it's great
- Makes long pages easier to navigate.
- Highlights the user’s destination clearly.
3. Ruby Text Positioning
Languages like Japanese or Chinese often use small notes next to characters. ruby-align
and ruby-position
help with that.
ruby {
ruby-align: center;
ruby-position: over;
}
✅ Why it's great
- Perfect for educational content or multilingual sites.
- Cleanly positions annotation text.
4. Relative Color Syntax & light-dark()
Adjust a color’s saturation or lightness using the new relative color syntax. Combine that with light-dark()
to switch between modes easily.
.element {
background: light-dark(#fff, #000);
}
✅ Why it's great
- Makes dark mode easier to manage.
- Create smooth, color-based themes dynamically.
5. Native Accordions (Exclusive Panels)
You don’t need JavaScript to create one-at-a-time expanding sections. HTML’s <details>
now supports exclusive mode:
<details name="faq">
<summary>Question 1</summary>
Answer here.
</details>
✅ Why it's great
- Easy to build clean, accessible accordions.
- No extra JS needed for toggling.
6. content-visibility
Skip rendering things that aren’t on screen yet with content-visibility
. This improves performance on long or complex pages.
.lazy-load {
content-visibility: auto;
}
✅ Why it's great
- Speeds up initial load.
- Especially useful for mobile or heavy pages.
7. font-size-adjust
Fonts may fall back if a custom one fails to load. font-size-adjust
keeps the text readable and proportional.
.text {
font-family: "MyFont", Arial, sans-serif;
font-size-adjust: 0.5;
}
✅ Why it's great
- Smooth fallback when fonts fail.
- Maintains text alignment and legibility.
8. transition-behavior
Need more control over transitions? transition-behavior
helps you reverse or fine-tune them—no JS required.
.card {
transition: opacity 0.25s;
transition-behavior: allow-discrete;
}
✅ Why it's great
- Supports advanced UI animations.
- Keeps interactions smooth and flexible.
9. @property & New Math Functions
Use @property
to define CSS variables with specific rules and types. Also, use functions like round()
or mod()
to simplify calculations.
@property --progress {
syntax: "<number>";
inherits: false;
initial-value: 0;
}
✅ Why it's great
- Lets you create powerful, typed CSS variables.
- Reduces need for preprocessors or JS math.
10. offset-path & offset-position
Animate elements along a path—no JavaScript needed. Perfect for motion design or guiding the user's attention.
.animated {
offset-path: path("M10,80 Q95,10 180,80");
offset-position: 0%;
transition: offset-position 2s ease;
}
✅ Why it's great
- Animate naturally along curves.
- Great for interactive UIs and creative effects.
Made with ❤️ for modern front-end developers.
I hope this was helpful, and I’d be happy to connect and follow each other!
Top comments (2)
Great tips.
Thanks! Glad you liked it 😊
Some comments may only be visible to logged-in visitors. Sign in to view all comments.