16 new CSS features
0 of 16 finished

Your journey0 of 16 finished

margin-trim

Stacks of paragraphs or cards leave extra margin above the first child and below the last. margin-trim goes on the container and removes that edge margin, so only the space between children is left.

Checking…Full support in Safari. Chrome and Edge support the block values only. Not in Firefox yet.

One

Two

Three

Every value

none
The default. Children’s margins push against the container’s edges as they always have.
block
Trims the top margin of the first child and the bottom margin of the last child (in horizontal writing modes).
block-start / block-end
Trims only one side: the top of the first child, or the bottom of the last.
inline
Trims the left edge of the first item and the right edge of the last item. Use it when the items run in a row, as in a flex row. Safari only for now.
inline-start / inline-end
One horizontal side only.
block inline
Values can be combined to trim every edge at once.

When the container is flex or grid, gap is often the better tool. margin-trim is for ordinary block flow, such as article bodies, cards, or CMS content where you don’t control the markup.

In a real page

A card that doesn’t care what’s inside it

Writers can start with a heading or a paragraph. The padding always looks even.

Release notes, version 4.2

Exports now keep your layer names, and the colour picker remembers your last ten swatches.

  • Faster PDF export
  • New keyboard shortcut for duplicate

Thanks to everyone who reported the font bug.

symbols()

A quick way to replace list bullets or numbers with your own characters, right inside list-style. You choose a system, which decides what happens when the list runs out of symbols, and then give the symbols.

Checking…Supported everywhere except Safari, according to the video. For a reusable or named version, use @counter-style, which works in all browsers.
  1. Apples
  2. Bread
  3. Coffee
  4. Dates
  5. Eggs
  6. Flour
  7. Garlic
  8. Honey
  9. Ice
  10. Jam
  11. Kale
  12. Lemons

Every value

cyclic
Goes through the symbols and starts again at the beginning: red, green, blue, red, green, blue…
fixed
Uses each symbol once. After the last one, the list goes back to normal decimal numbers (5, 6, 7…).
symbolic
Repeats the symbol to count higher: *, †, **, ††, ***, †††… This is the classic footnote pattern.
alphabetic
Combines symbols like spreadsheet column names: A, B, AA, AB, BA, BB, AAA… Needs at least two symbols.
numeric
Like alphabetic, but the first symbol acts as zero, so it never appears as a leading prefix. "0" "1" counts in binary: 1, 10, 11, 100…
@counter-style
The full version. It has a name and can also set prefix, suffix, range, pad and fallback. It works with counter() anywhere, not just in lists.

In a real page

Footnotes that number themselves

A custom counter style lets the references and the notes share one symbol sequence.

The bridge opened in 1932 and was painted grey until 1974. The current red came from a public vote.

  1. City archive, box 14.
  2. Paint contract, 1974.
  3. Gazette, 9 May 1975.

Emoji markers without touching the HTML

A plain <ul>. The emoji live only in the CSS.

  • Book the train
  • Pack the tent
  • Buy snacks
  • Charge the camera
  • Water the plants

progress()

progress(value, start, end) tells you how far a value is between two points, as a number from 0 to 1. Values outside the range are clamped. On its own that sounds dull. Once you multiply it into widths, hues, radii or opacity, it can do a lot of the work of an if statement.

Checking…Available in all major browsers.
050100

Every value

progress(v, a, b)
Returns (v − a) / (b − a), clamped between 0 and 1. All three arguments must be the same type: three numbers, or three lengths, and so on.
numbers
progress(var(--total), 0, 75). Usually fed from a custom property that JavaScript or an inline style sets.
lengths
progress(100cqi, 260px, 640px) gives a container size as a ratio, which is the basis for fluid components.
with round()
round(down, var(--p), 1) is 0 until the ratio reaches 1, then becomes 1. That works as an on/off switch for opacity, display widths or scale.
with calc()
Multiply the ratio by the size of any range: calc(12px + var(--p) * 28px) moves smoothly from 12px to 40px.

In a real page

Free-shipping meter

JavaScript only sets --total. The bar, its colour, the “$X more” text and the unlock message are all CSS.

Add more for free shipping You unlocked free shipping

Cart total:

A fluid profile card with no breakpoints

Drag the bottom-right corner. Padding, gap, font size, avatar size and avatar roundness all follow the card’s width.

AK
Aiko Kimura Type designer, Osaka

light-dark() for images

light-dark() used to accept colours only. It now takes images as well: url() files, and gradients, which also count as images. Set color-scheme: light dark, then give the light value first and the dark value second.

Checking…Image support is in all major browsers.

Same element, same CSS.

Every value

color-scheme
Required. light dark follows the user’s system. light or dark forces one theme for that element and its children.
light-dark(<color>, <color>)
The original form, for any colour property.
light-dark(<image>, <image>)
New: url(), linear-gradient(), radial-gradient(), conic-gradient() and so on, in background-image, list-style-image, border-image and mask-image.
both values must match
Use two colours or two images. Mixing a colour with an image makes the declaration invalid.

In a real page

A landing hero that changes with the theme

The checkbox sets color-scheme through :has(). The sky, the stars, the sun and moon, and the hills all come from light-dark(). No JavaScript.

Camp under real stars

Forty pitches, no light pollution.

alpha()

A relative colour function that changes only the transparency of a colour and leaves the rest alone. Write alpha(from var(--brand) / 0.2), and one brand variable can supply the text colour, a tinted background, the border and the hover state.

Checking…New in 2026. Before it, use rgb(from var(--c) r g b / 0.2) for the same result in older browsers.
alpha(from var(--c) / var(--a))
/ 1
/ 0.75
/ 0.5
/ 0.25

Every value

alpha(from C / A)
Takes colour C and sets its alpha to A, a number from 0 to 1 or a percentage.
alpha keyword
Inside the function, alpha is the original colour’s alpha. calc(alpha * 0.5) halves it, even if it was already translucent.
none
alpha(from C / none) marks the alpha as a missing component, which matters when you interpolate.
vs. rgb(from …)
The longer form is rgb(from C r g b / A). alpha() works the same way whatever colour space C is in.

In a real page

One variable per tone

Each alert sets only --tone. Text, background, border and button hover all come from it.

Payment failed. Your card was declined. Try another card.

Backup complete. 2,314 files copied at 09:12.

New version ready. Restart to install it.

random()

random(min, max) picks a value in that range when styles are computed. Each element gets its own value, and you get a new set on every page load. Add a step and the values snap to fixed increments. Add a key and you control which elements and properties share the same random value.

Checking…Supported in Safari, Chrome and Edge. In the Firefox beta.

Every value

random(min, max)
Any value in the range, min and max included. Both must be the same type: numbers, lengths, angles or times.
random(min, max, step)
Gives only min + n × step. Use it for a fixed set of hues, 15° rotations, or snapping to a grid.
auto
The default key. Each element, each property, and each random() within a property gets its own independent value.
element-scoped
One value per element that all its properties share. Width and height become equal, so you get random squares.
property-scoped
One value per property that all elements share. Every element gets the same random rotation.
--name
A named key. Every random() with the same name and the same range gets the same value, even across elements.
fixed 0.42
A seed you choose, from 0 up to (but not including) 1. Gives the same “random” value every time, which helps with testing.
random-item(key, a, b, c)
The sibling function. It picks one item from a list, such as colours or whole border values. The key is required. Support is more limited.

In a real page

A sticky-note board

Reload the page: every note tilts, shifts and takes one of five colours.

  • Water the basil
  • Call the plumber about the kitchen tap
  • Return library books
  • Mia’s birthday on the 14th
  • Renew passport
  • Try the new ramen place

Snowfall in pure CSS

JavaScript only adds 70 empty <span>s. Position, size, opacity, speed and start time are all set by random().

text-overflow: "your string"

You’ve probably used text-overflow: ellipsis to add “…” to clipped text. It now also accepts a string, so a cut-off line can end with whatever you want. With two values, you can mark both ends of a line you scroll through.

Checking…The one-string form works everywhere except Safari, which has it in beta. The two-value form only really works in Firefox.
The quick brown fox jumps over the lazy dog, then naps in the sun for the rest of the afternoon.

Drag the box’s corner to resize it.

Every value

clip
The default. Text is cut off at the edge, even in the middle of a letter.
ellipsis
Shows “…”. The classic.
"string"
Any text you like, such as " [+]" or "…→". If the box is too narrow, the string itself gets clipped.
"left" "right"
Two values: the first marks the left edge and the second the right edge. It shows up when the text is scrolled and there’s hidden content on both sides.
needs all three
It only works with overflow other than visible and with text that doesn’t wrap (white-space: nowrap).

In a real page

Markers at both ends of a scrolling line

Scroll the path sideways. In Firefox, both ends show a marker while there is hidden text on that side.

/Users/aiko/Documents/Clients/Northwind/2026/Brand refresh/Final/Logos/northwind-wordmark-final-v7-REALLY-final.svg

scroll-snap-type: pair

With both, the browser snaps each axis separately. On a layout that isn’t a perfect grid, you can end up lined up with item 4 horizontally and item 5 vertically, so you’re centred on neither. pair chooses one target for x and y together.

Checking…New in Chromium (around version 156). It’s a safe enhancement: declare both first and pair second.
1
2
3
4
5
6

Every value

x / y / block / inline
Snap on one axis only.
both
Snap on both axes, but each axis picks its own target.
pair
Snap on both axes to the same element, so you always land centred on an item.
mandatory
Always comes to rest on a snap point.
proximity
Snaps only if you stop close to a snap point.
scroll-snap-align
Set on the children: start, center or end, and one value per axis is allowed.

In a real page

Trail map with waypoints

Pan around and the map settles on the nearest waypoint, centred.

Trailhead Lookout Waterfall Lake camp Summit

sibling-index() & sibling-count()

sibling-index() gives an element’s position among its siblings, starting at 1. sibling-count() gives how many siblings there are. Both are integers you can use in calc(), which replaces stacks of :nth-child rules and style="--i: 3" attributes.

Checking…Check the badge for your browser. Add fallback values for older browsers.

Every value

sibling-index()
1 for the first child, 2 for the second, and so on. Subtract 1 to start from zero: calc(sibling-index() - 1).
sibling-count()
The total number of children of the parent, the element included. It updates live when you add or remove nodes.
reverse order
sibling-count() - sibling-index() counts down to 0 at the last child. Use it for reverse staggers and z-index stacks.
centred offset
sibling-index() - (sibling-count() + 1) / 2 is 0 for the middle child, negative to the left and positive to the right. That’s what makes a fan of cards.

In a real page

A staggered menu, in and out

Pure CSS: a checkbox and :has(). It opens top-down and closes bottom-up.

A hand of cards that fans itself

Add or remove cards. The spread stays centred because every angle is worked out from the index and the count.

♠
♥
♦
♣
♠

Avatar stack, left on top

Normally the right-hand avatar covers the left one. Reversing the z-index takes one line.

AKRBMJTS+4

Gap decorations

Anything with a gap (grid, flex or multi-column) can now draw lines inside that gap, much like borders. You can also change colour and style from one gap to the next, decide what happens where lines cross, shorten the ends, and hide lines next to empty cells.

Checking…Shipped in Chromium (Chrome and Edge). Not yet in Firefox or Safari.
1
2
3
4
5
6
7
8
9
10
11
12

Every value

rule
Shorthand for both directions, written like a border: rule: 1px solid gray.
column-rule / row-rule
One direction only. column-rule used to work only in multi-column layout and now works in grid and flex too. Each has -width, -style and -color longhands.
lists & repeat()
Width, style and colour take comma-separated lists that cycle across gaps: red, blue alternates, and repeat(2, red), green gives red, red, green.
rule-break
normal lets lines stop at spanning items. none draws straight through everything. intersection breaks a line wherever gaps cross. There are per-axis column-rule-break and row-rule-break too.
rule-inset
Shortens lines (positive values) or extends them (negative values). rule-inset-cap affects only the free ends of a line. rule-inset-junction affects only the ends where lines meet.
overlap-join
An inset value that makes lines meet and overlap cleanly at junctions, with no small gaps at the corners.
rule-visibility-items
all draws every gap. around draws only next to real items, so empty cells get no lines. between draws only where items sit on both sides.
animatable
Width, colour and inset can be transitioned.

In a real page

Toolbar dividers

No border hacks and no :not(:last-child).

A month calendar

Every line comes from three declarations, and there are no lines around the empty cells before the 1st.

MoTuWeThFrSaSu 12345 6789101112 13141516171819 20212223242526 2728293031

contrast-color()

Give it a background colour and the browser returns whichever of black or white reads better on it. If you chose the colours yourself, just pick good ones. Where this really helps is when users pick colours: tags, labels, calendar events, team colours.

Checking…Available in all major browsers.
Pick any background
YellowOrangeRedGreenSkyBluePurpleWhite

Every value

contrast-color(C)
Returns white or black, whichever contrasts more with C. That’s the whole interface for now.
it isn’t magic
Mid-tones such as pure orange or medium grey can fall short of strict contrast targets in either direction. Avoid them for small text.
future versions
The spec discusses choosing from a list of candidate colours and a target contrast level. Those aren’t shipped yet.

In a real page

A label maker

Pick a colour and add a label. The text colour is never chosen in JavaScript.

Design Backend

shape()

path() takes SVG path syntax with fixed pixel values, so it can’t stretch. shape() describes the same kind of drawing with CSS words and CSS units: percentages, calc() and variables. The shape can grow with its box while details such as an arrow tip stay a fixed size. Use it with clip-path or offset-path.

Checking…Available in all major browsers.
Resize me

Drag the corner. The 40px tip keeps its size.

Every value

from x y
The starting point. You can also put nonzero or evenodd first to set the fill rule.
move to / by
Jumps to a new point without drawing and starts a new sub-path. to is absolute and by is relative to the current point.
line to / by
A straight line to a point.
hline / vline
A horizontal or vertical line. It needs only one coordinate.
curve to P with C1 [/ C2]
A Bézier curve. One control point makes a quadratic curve and two make a cubic one.
smooth to P [with C]
Continues the previous curve smoothly by mirroring its last control point. Ideal for waves.
arc to P of R [cw|ccw] [large|small] [rotate θ]
An elliptical arc with radius R (give two radii for an ellipse).
close
Draws a straight line back to the start.
animation
Two shape() values with the same list of commands interpolate smoothly, so you can morph one into the other.

In a real page

A section header with a wavy edge

Resize the browser. The wave stretches, and its depth stays at 30px.

Spring workshop series

Six Saturdays of letterpress, binding and risograph.

Chat bubbles with a tail

Short or long, the body stretches and the tail keeps its size.

Running late!

No worries. We saved you a seat by the window, and the soup of the day is pumpkin.

A button that turns into an arrow

Hover or focus it. Both shapes use the same commands, so the browser can animate between them.

corner-shape

border-radius sets how big a corner is. corner-shape sets what form it takes. The background, border, outline and shadow all follow the new shape.

Checking…Shipped in Chromium. In beta in Firefox and Safari.

Every value

round
The default. The usual circular corner. Same as superellipse(1).
squircle
A smoother corner, like an app icon. Same as superellipse(2).
bevel
A straight diagonal cut. Same as superellipse(0).
scoop
A concave quarter circle, like a ticket stub. Same as superellipse(-1).
notch
A square step cut into the corner. Same as superellipse(-infinity).
square
Removes the rounding, so the radius has no effect. Same as superellipse(infinity).
superellipse(k)
Any value in between. Higher numbers are squarer and negative numbers curve inwards. Because it’s a number, it can be animated.
per corner
Up to four values like border-radius, plus longhands such as corner-top-left-shape.

In a real page

An event ticket

One declaration gives the scooped corners.

Admit oneNight Market JazzFri 12 Dec · Gate B
Row F
Seat 14

Notched buttons that soften on hover

The shape animates between keywords.

Anchor positioning

Attach one element to another, so a tooltip or menu sits beside its button. When it would run out of space, it flips to the other side. Together with the popover attribute, this covers what tooltip libraries like Popper or Floating UI used to do, with no JavaScript.

Checking…In all major browsers for about a year.
Anchor
I follow the anchor

Every value

anchor-name
Names an element as an anchor, for example --menu-btn. A dashed ident is required.
position-anchor
Set on the positioned element (absolute or fixed) to say which anchor it follows.
position-area
An imaginary 3×3 grid around the anchor. top, bottom right, left center, and with span-* you can stretch across two cells: bottom span-right.
anchor()
Fine-grained control in inset properties: top: anchor(bottom), left: anchor(center).
anchor-size()
Size relative to the anchor: min-width: anchor-size(width) keeps a menu at least as wide as its button.
position-try-fallbacks
What to try when the element overflows: flip-block (up and down), flip-inline (left and right), flip-start, other position-area values, or your own @position-try rules.
position-try-order
Picks the fallback with the most space, for example most-height.
position-visibility
anchors-visible hides the element when its anchor scrolls out of view. no-overflow hides it when it can’t fit.
popover + popovertarget
HTML that opens and closes an element on the top layer, with light dismiss, Escape to close and focus handling built in.

In a real page

A dropdown menu with zero JavaScript

Opening, closing, positioning, flipping and matching the button’s width are all handled by HTML and CSS.

A badge that follows a row as it scrolls

Scroll the list. The badge stays attached to the row and disappears once the row scrolls out of view.

Inbox

Drafts

Invoices

Sent

Archive

Spam

Receipts

Travel

Family

Newsletters

Old projects

Misc

3 unpaid

:playing, :paused & friends

Seven pseudo-classes describe what an <audio> or <video> element is doing right now. Combined with :has(), the rest of the page can respond to a video without any event listeners.

Checking…In Chrome, Safari and Firefox. Edge is following. Part of Interop 2026.
:playing:paused:seeking:buffering:stalled:muted

Every value

:playing
The media is playing. It also matches while it buffers, because it’s still trying to play.
:paused
Paused, including before it has ever played. Every media element is either :playing or :paused.
:seeking
The user is jumping to a new position.
:buffering
Trying to play but waiting for data. A subset of :playing.
:stalled
Buffering, and no data has arrived for a while. Usually a sign of a network problem.
:muted
The sound is muted (the muted attribute or property).
:volume-locked
The OS or browser won’t let the page change the volume, as on many phones. Hide your volume slider when this matches.

In a real page

Custom controls whose icons follow the video

JavaScript only calls play(), pause() and toggles muted. CSS chooses every icon, label and visual state.

Loading…

text-decoration-inset

Underlines have always run the full width of the text. text-decoration-inset moves where they start and end: a positive value pulls the ends in, a negative value pushes them out. It can be animated, so the classic “underline grows from the middle” effect no longer needs a pseudo-element.

Checking…In Chrome and Edge 157+ and Firefox 146+. Safari has it in beta.

Underline me

The red line is the text decoration.

Every value

0
The default. The line runs exactly the width of the text.
<length>
One value insets both ends. Positive values shorten the line and negative values lengthen it.
<start> <end>
Two values, one per end. 1em -1em shifts the whole line to the right.
auto
A small automatic inset so neighbouring underlined boxes, such as two links side by side, don’t merge into one line.
related: text-underline-offset
Moves the line up (negative) or down (positive). With a thick line and a negative offset you get a highlighter effect.
related: text-decoration-skip-ink
none stops the line from breaking around descenders. You need it when the line sits behind the letters.

In a real page

Nav links whose underline grows from the centre

Hover or focus a link. No ::after, no borders, no transforms.

A highlighter mark that overhangs a little

A thick underline, moved up behind the letters and pushed past both ends.

The meeting moved to Thursday at 3pm, in the small room.

Keeping neighbouring links apart

Top: the two underlines run together. Bottom: auto leaves a small gap between them.