Modern CSS: New Features

Bonus lecture: corner-shape, modern colors (oklch, relative colors) and animating underlines with a gradient

1. Corner-shape: new corner shapes

The Corners Level 2 CSS specification adds the corner-shape property, which changes the shape of rounded corners. Previously, border-radius only produced circular rounding; now new options are available.

Warning: this is an experimental specification (2026). No browser yet supports corner-shape in a stable release. This material is here to introduce you to the future of CSS.

Possible values

Value Effect Where it may be useful
round Ordinary rounding (as it is now) Default value
scoop Concave corner (cut inward) Decorative cards, tickets
bevel Chamfered corner (cut at 45°) Tags, badges, tech style
squircle Superellipse (like iOS icons) App icons, avatars
notch Rectangular cutout Promo blocks, non-standard design

Syntax

.card-ticket {
border-radius: 20px;
corner-shape: scoop;
}
.badge {
border-radius: 8px;
corner-shape: bevel;
}
.app-icon {
border-radius: 22%;
corner-shape: squircle;
}

Different shapes for different corners

You can set a different shape for each corner individually:

.creative-card {
border-radius: 20px;
corner-shape: scoop round bevel round;
/* top-left top-right bottom-right bottom-left */
}
Squircle vs round: an ordinary border-radius creates a perfect circular arc. A squircle (superellipse) is a smoother transition from a straight line to a curve, like Apple icons. The difference is subtle but noticeable at large radii.

2. Modern color syntax

CSS is evolving from the old rgba() syntax toward new, more powerful ways of specifying colors.

New rgb / hsl syntax (no commas)

Modern CSS lets you write colors with spaces instead of commas, and transparency with /:

/* Old syntax */
color: rgba(59, 130, 246, 0.5);
/* New syntax (no commas, no "a") */
color: rgb(59 130 246 / 0.5);
color: hsl(217 91% 60% / 0.5);
Support: the new syntax is supported by all modern browsers. You can safely use it in new projects.

oklch — a perceptually uniform color space

oklch() defines a color through:

  • L (lightness) — brightness from 0% (black) to 100% (white)
  • C (chroma) — saturation (0 = gray, 0.4+ = vivid)
  • H (hue) — hue in degrees (0 = pink, 90 = yellow, 180 = cyan, 270 = purple)
/* Blue with chroma 0.2 */
color: oklch(60% 0.2 250);
/* Semi-transparent green */
color: oklch(70% 0.18 150 / 0.7);

Why is oklch better than hsl?

In hsl, two colors with the same L can look differently bright to the eye (yellow seems lighter than blue). In oklch, the same lightness looks the same for any hue — this matters for design systems and palettes.

Relative colors

They let you create new colors based on existing ones — by changing individual components:

:root {
--brand: oklch(60% 0.2 250);
}
.card {
/* Take --brand and make it lighter */
background: oklch(from var(--brand) calc(l + 0.2) c h);
/* Take --brand and make it semi-transparent */
border-color: oklch(from var(--brand) l c h / 0.3);
}

Here from var(--brand) takes the source color, while l, c, h are its components, which can be modified with calc().

Practical application

:root {
--accent: oklch(55% 0.25 260);
}
.btn {
background: var(--accent);
}
.btn:hover {
/* Automatically darker shade */
background: oklch(from var(--accent) calc(l - 0.1) c h);
}
.btn:active {
/* Even darker */
background: oklch(from var(--accent) calc(l - 0.2) c h);
}
The advantage of relative colors: change a single CSS variable --accent, and all hover/active states are recalculated automatically. You don’t need to hand-pick colors for each state.

3. Animating an underline with a gradient

An animated link underline is a popular effect that can be implemented with background-image instead of text-decoration.

The idea

  • The underline is a background-image in the form of a linear gradient
  • The background size (background-size) changes from 0% to 100% on hover
  • The transition is animated with transition

Basic example

.link {
text-decoration: none;
background-image: linear-gradient(currentColor, currentColor);
background-position: 0% 100%;
background-repeat: no-repeat;
background-size: 0% 2px;
transition: background-size 0.3s ease;
}
.link:hover {
background-size: 100% 2px;
}

How it works

  • linear-gradient(currentColor, currentColor) — a “gradient” made of a single color (that is, a solid line in the text color)
  • background-position: 0% 100% — the background is anchored to the bottom-left corner
  • background-size: 0% 2px — width 0% (invisible), height 2px
  • On hover the width grows to 100% — the line “slides out” from left to right

Direction variations

/* Left to right (default) */
background-position: 0% 100%;
/* Right to left */
background-position: 100% 100%;
/* From the center outward in both directions */
background-position: 50% 100%;

A color gradient instead of a solid line

.link-gradient {
background-image: linear-gradient(90deg, #3b82f6, #8b5cf6);
background-position: 0% 100%;
background-repeat: no-repeat;
background-size: 0% 2px;
transition: background-size 0.3s ease;
}
.link-gradient:hover {
background-size: 100% 2px;
}
Why not text-decoration? The text-decoration property doesn’t support transition for width or color. background-image gives full control over the animation, thickness, color, and direction.

4. Summary table

Topic What to remember
corner-shape scoop, bevel, squircle, notch — new corner shapes (experimental)
rgb/hsl without commas rgb(59 130 246 / 0.5) — spaces instead of commas, / for transparency
oklch() Perceptually uniform: L (lightness), C (chroma), H (hue)
Relative colors oklch(from var(--color) calc(l + 0.2) c h) — relative colors
Gradient underline background-image + background-size + transition

Vitalii Kaplia

Founder, Web Developer & WordPress Expert

I became interested in programming back in 1997. The first acquaintance with a future profession was using Visual Basic. In…

More about author

A digital product engineer and web solutions architect

Free consultation + cost calculation

Let’s discuss your project?

Free consultation + cost calculation

More interesting articles

Customer login

This site uses cookies

We use cookies to personalize content and ads, provide social media features, and analyze our traffic. We also share information about your use of our website with our social media, advertising, and analytics partners, who may combine it with other information you have provided to them or collected when you use their services. By continuing to use our site, you consent to our use of cookies and accept our Privacy Policy and Terms of Use.

Virtual assistant
Hi! I'm the KAPLIA.PRO virtual assistant! I can tell you about our services, portfolio projects, ballpark pricing, and how we work — from websites and eCommerce to web apps, CRMs, bots, and AI agents. Ask away!

By continuing with the AI assistant, I agree to the site’s terms of use and privacy policy.

AI assistant may make mistakes in responses