DEV Community

Cover image for The 10 Best New CSS Features in 2025 Already Supported in All Major Browsers
DevUnionX
DevUnionX

Posted on

The 10 Best New CSS Features in 2025 Already Supported in All Major Browsers

CSS continues to evolve with new capabilities that enhance our workflows, making them faster, cleaner, and more powerful. Thanks to the advancements in browser support (Baseline 2024), many of these exciting features are now fully compatible with all major engines. Below, we highlight ten of the most notable CSS features you can start using today.

1. Scrollbar-Gutter & Scrollbar-Color

When browsers display a scrollbar, it can often cause layout shifts as space is taken up. The scrollbar-gutter property helps you preserve space for the scrollbar even before it appears, ensuring a stable layout.

.scrollable {
  scrollbar-gutter: stable both-edges;
}
Enter fullscreen mode Exit fullscreen mode

Additionally, you can style your scrollbars with scrollbar-color:

.scrollable {
  scrollbar-color: #444 #ccc;
}
Enter fullscreen mode Exit fullscreen mode

What it's good for: The scrollbar-gutter property keeps layouts stable by reserving space for the scrollbar, preventing unwanted shifts when it appears. Meanwhile, scrollbar-color allows you to style the scrollbar's track and thumb, enhancing design consistency, especially for dark-themed UIs.

2. ::target-text

The ::target-text pseudo-element highlights the specific text reached by an internal link (e.g., clicking an anchor on the same page).

::target-text {
  background: yellow;
  color: black;
}
Enter fullscreen mode Exit fullscreen mode

What it's good for: This feature highlights the exact text targeted by an anchor link, making it clear where users have landed in long documents or articles.

3. Ruby Layout (ruby-align & ruby-position)

For languages that use annotations (e.g., East Asian languages), the ruby-align and ruby-position properties give you precise control over the placement of ruby text (annotations).

ruby {
  ruby-align: center;
  ruby-position: over;
}
Enter fullscreen mode Exit fullscreen mode

What it's good for: This is essential for East Asian typography, where annotations (ruby text) need to be positioned either above or beside the main text. It's also useful in educational or reference materials for inline annotations.

4. Relative Color Syntax & light-dark()

The new relative color syntax allows you to adjust properties like lightness or saturation from an existing color. The light-dark() function simplifies toggling between light and dark color values.

.element {
  background: light-dark(#ffffff, #000000);
}
Enter fullscreen mode Exit fullscreen mode

Additionally, you can use color-interpolation-method to create smoother gradients in different color spaces.
What it's good for: Relative color syntax enables dynamic adjustments like saturation or lightness based on a reference color. The light-dark() function easily switches between light and dark color values, making it perfect for themes or dark mode implementations.

5. Exclusive Accordions

Accordions that require JavaScript for mutual exclusivity are now simplified with HTML's details element. You can use the name attribute to ensure that only one panel is open at a time.

<details name="exclusive">
  <summary>Details</summary>
  Something small enough to escape casual notice.
</details>
Enter fullscreen mode Exit fullscreen mode
details {
  border: 1px solid #aaa;
  border-radius: 4px;
  padding: 0.5em 0.5em 0;
}

summary {
  font-weight: bold;
  margin: -0.5em -0.5em 0;
  padding: 0.5em;
}

details[open] {
  padding: 0.5em;
}

details[open] summary {
  border-bottom: 1px solid #aaa;
  margin-bottom: 0.5em;
}
Enter fullscreen mode Exit fullscreen mode

What it's good for: This allows you to create exclusive accordions (only one panel open at a time) without needing complex JavaScript. It's ideal for FAQs, menus, or any case where only one detail should be shown.

6. content-visibility

The content-visibility property skips rendering off-screen elements until they are scrolled into view, improving page performance.

.lazy-load-section {
  content-visibility: auto;
}
Enter fullscreen mode Exit fullscreen mode

What it's good for: This defers rendering of off-screen elements, boosting performance for long pages or complex layouts. It reduces memory usage and improves load speed, especially on mobile devices.

7. font-size-adjust

When custom fonts are unavailable, browsers often fall back to another font, which can disrupt the layout. The font-size-adjust property helps maintain text size and legibility across different fonts.

.text {
  font-family: "CustomFont", Arial, sans-serif;
  font-size-adjust: 0.5;
}

Enter fullscreen mode Exit fullscreen mode

What it's good for: This ensures consistent text appearance when custom fonts are unavailable or loading slowly. It helps preserve readability and design consistency by matching the x-height of fallback fonts.

8. transition-behavior

While transition-timing-function has been a staple, transition-behavior adds extra control over animations, such as reversing or pausing transitions without needing complex JavaScript.

.card {
  transition-property: opacity, display;
  transition-duration: 0.25s;
  transition-behavior: allow-discrete;
}
.card.fade-out {
  opacity: 0;
  display: none;
}
Enter fullscreen mode Exit fullscreen mode

What it's good for: This expands basic transitions to allow more complex animations or reversible transitions without scripting. It's useful for smoother UI interactions and advanced animation scenarios.

9. CSS @property & Stepped Value Functions

The @property rule allows you to declare custom properties with predefined syntax, inheritance rules, and initial values.

@property --animation-progress {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
Enter fullscreen mode Exit fullscreen mode

Additionally, new stepped value functions like round(), mod(), and rem() simplify calculations directly in CSS, reducing the need for preprocessors or JavaScript.
**What it's good for: **The @property rule makes custom properties fully declared with types, defaults, and inheritance rules. Stepped value functions enable simple math in CSS for smoother, more maintainable code.

10. offset-position & offset-path

For more complex motion design, offset-position and offset-path allow you to animate elements along custom paths without heavy JavaScript frameworks.

.move {
  offset-path: path("M10,80 Q95,10 180,80");
  offset-position: 0%;
  transition: offset-position 2s ease;
}
Enter fullscreen mode Exit fullscreen mode

What it's good for: This enables path-based motion and animation purely in CSS. It's ideal for interactive elements, motion graphics, or guiding user attention along custom paths.

These features offer a range of new possibilities for modern web design, from performance improvements to more dynamic, visually engaging interactions. As browsers continue to improve support for CSS, these capabilities will only become more powerful, giving developers even more tools to create exceptional user experiences.

FALLOW ME FOR MORE
https://x.com/DevUnionX

Top comments (2)

Collapse
 
yaireo profile image
Yair Even Or • Edited

Many are not new at all...

It is a bit embarrassing, so I advise editing the post and removing the non-new ones which are not related to features new in the year 2025 (as the title falsely claims)

Collapse
 
youngfra profile image
Fraser Young

CSS just keeps getting more superpowers! Loving these new features—my stylesheets are about to feel like they went to the gym. 💪🖌️