Scrolling Gets Smarter with Markers, Buttons, and Scroll State

New CSS can track what is stuck, what is active, and where scrolling goes next

Conceptual CSS artwork for Scrolling Gets Smarter with Markers, Buttons, and Scroll State.

Scroll UI used to split neatly into two categories.

Either you left it mostly alone and accepted the browser defaults, or you built something custom and signed yourself up for a surprising amount of JavaScript.

Carousels, sticky headers, active section indicators, pagination dots, scroll-triggered effects—none of these were impossible. They just usually involved a lot of wiring.

That is what makes this moment interesting. CSS is starting to understand scroll state in a much more direct way.

Why scroll-based UI has always been awkward

A lot of front-end patterns depend on scroll state, but CSS historically had very little awareness of it.

You could make something sticky, but not easily detect when it was actually stuck. You could build a carousel, but the pagination dots and buttons usually needed JavaScript to stay in sync. You could highlight the section currently in view, but again, that usually meant observers, event listeners, and state management.

None of that was especially elegant. It worked, but it always felt like the browser knew what was happening and just was not letting CSS participate.

These newer features start to close that gap.

What is changing in modern CSS

There is not just one new feature here. It is more like a cluster of related updates that all point in the same direction.

Container scroll-state() queries let CSS react to things like whether something is stuck, snapped, or scrollable. :target-current gives you a way to style the currently active marker in a scroll marker group. And ::scroll-marker plus ::scroll-button() give scroll containers native hooks for pagination controls and previous/next buttons.

Taken together, they make scroll interfaces feel less like custom widgets and more like something the platform actually understands.

The mental model (this is the part that matters)

The easiest way to think about this is that CSS is getting three new kinds of awareness.

First, it can understand more about the state of scrolling itself. Second, it can expose built-in UI for navigating scroll containers. Third, it can tell you which “page” or section inside that scroll experience is currently active.

CSS is not just styling a scroller anymore. It is starting to understand the experience of moving through it.

That shift is what makes these features feel bigger than they first appear.

Detecting scroll behavior with @container scroll-state(...)

Scroll-state queries are probably the most conceptually important part of this group.

Regular container queries ask about size. Scroll-state queries ask about scroll-related conditions instead.

That means you can style descendants based on things like whether a sticky element is currently stuck, whether a snapped item is the one currently snapped into place, or whether a container can still scroll in a given direction.

.section-heading {
  position: sticky;
  top: 0;
  container-type: scroll-state;
}

@container scroll-state(stuck: top) {
  .section-heading {
    box-shadow: 0 1px 0 rgb(0 0 0 / 0.12);
    background: color-mix(in oklab, white 88%, black);
  }
}

This is one of those features that feels obvious the moment you see it.

Sticky headers have existed for a while. Being able to style them differently when they are actually stuck is the missing half.

Styling the active position with :target-current

Once you have scroll markers, you need a way to know which one represents the current position.

That is where :target-current comes in. It selects the active scroll marker in a marker group—the one representing the section or “page” currently in view.

::scroll-marker {
  inline-size: 0.75rem;
  block-size: 0.75rem;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.2);
}

::scroll-marker:target-current {
  background: currentColor;
  transform: scale(1.15);
}

The practical payoff is immediate: active dots, active chapters, active slides, active sections in a scroller.

And because this is tied to the browser’s understanding of the scroll marker group, it is less brittle than trying to manually synchronize classes with JavaScript.

Native pagination with ::scroll-marker and ::scroll-button()

This is where things start to feel a little futuristic in the best way.

::scroll-marker gives elements generated markers that behave like anchors for their scroll targets. ::scroll-button() gives scroll containers generated buttons for directional navigation.

In plain terms: CSS can now help create the dots and buttons people expect in things like carousels and horizontally scrolling galleries.

.carousel {
  overflow-x: auto;
  scroll-snap-type: inline mandatory;
  scroll-marker-group: after;
}

.carousel::scroll-button(left),
.carousel::scroll-button(right) {
  content: "";
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgb(0 0 0 / 0.14);
}

.slide::scroll-marker {
  content: "";
}

The impressive part is not just that the UI appears. It is that the browser understands what those controls are for.

This is a very different proposition from hand-building a slider and then teaching it how to behave.

Scroll-triggered animation gets more believable

This group of features also changes what “scroll-triggered animation” can mean.

Traditionally, that phrase meant JavaScript listening for intersections or scroll positions. Now there is a more CSS-native route, especially when paired with snapped states or sticky detection.

.panel {
  container-type: scroll-state;
  transition: scale 180ms ease, opacity 180ms ease;
  opacity: 0.65;
  scale: 0.96;
}

@container scroll-state(snapped: inline) {
  .panel {
    opacity: 1;
    scale: 1;
  }
}

This is not the same thing as full scroll-driven animation timelines, but it covers a lot of the “make the active item feel active” territory in a clean way.

Sometimes you do not need continuous animation. You just need the right moment to react.

Where this becomes genuinely useful

Carousels are the obvious headline example, but this goes beyond carousels pretty quickly.

Think article navigation that highlights the section currently in view. Think horizontally scrolling card rails with native-feeling next and previous controls. Think sticky subheadings that visibly change when they lock into place. Think snapped panels that emphasize the currently focused item without any observer setup.

This is why people are excited. These are not weird demo-only tricks. They map directly to UI patterns teams have been building for years.

What to watch for

The honest version is that this is still modern-technique territory, not old dependable CSS.

Some of these features are new enough that support is uneven, and some related pieces are still clearly experimental in MDN’s documentation. That means progressive enhancement is the right mindset here.

It is also worth remembering that “native” does not automatically mean “done.” You still need to think about spacing, focus states, overflow behavior, and whether the UI actually benefits from extra controls.

Rule of thumb:
Treat these features as a way to simplify scroll UI you already need—not as a reason to invent a carousel where a plain list would have worked.

Can you use this today?

You can absolutely experiment with it today, and that is probably the right framing.

The underlying ideas are real and moving quickly, but this is still an area where support and implementation details matter. If you use these in production, do it as enhancement rather than dependency.

A simple baseline with regular scrolling, normal links, and no CSS-generated controls should still work. Then the newer behavior can layer on where supported.

Quick answers

Is this just for carousels?

No. Carousels are the flashy example, but active section indicators and sticky-state styling may end up being the more broadly useful patterns.

Do I still need JavaScript?

Sometimes, yes. But the amount of JavaScript needed for scroll-aware UI can be much smaller when the browser handles more of the relationship itself.

What is the biggest shift here?

CSS is getting closer to understanding scrolling as state—not just as movement.

Want to go deeper?

This whole cluster of features is worth watching because it says something bigger about where the platform is going.

Scroll UI used to be one of those areas where native browser behavior and custom front-end ambition never quite met in the middle. That middle is starting to exist now.

If modern CSS is getting more practical, this is exactly what that looks like.