v149 · CSS

Snap Carousel

Scroll the carousel below. The snapped card expands its text, scales up, and flips to inverted colours — using only @container scroll-state(snapped: x). No JavaScript tracks the active index.

Feature detection: checking…
/* Each slide is its own scroll-state container */
.slide {
  container-type: scroll-state;
  container-name: slide;
  scroll-snap-align: center;
}

/* Base (not snapped) — scaled down, no excerpt */
.slide-inner {
  transform: scale(0.93);
  transition: transform 0.3s, background 0.3s;
}
.slide-excerpt {
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s, opacity 0.3s;
}

/* Snapped — expands, inverts, scales up */
@container slide scroll-state(snapped: x) {
  .slide-inner {
    transform: scale(1);
    background: var(--text-black);
  }
  .slide-excerpt {
    max-height: 6rem;
    opacity: 1;
    color: var(--bg-stone);
  }
}

see also

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗