<!-- for article: https://utilitybend.com/blog/love-at-first-slide-creating-a-carousel-purely-out-of-css -->
<div class="wrapper">
  <div class="carousel">
    <div>
      <span>You</span>
    </div>
    <div>
      <span>+</span>
    </div>
    <div>
      <span>HTML</span>
    </div>
    <div>
      <span>I</span>
    </div>
    <div>
      <span>♡</span>
    </div>
    <div>
      <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 1000 1000" aria-labelledby="css-logo-title css-logo-description">
        <path fill="#639" d="M0 0h840a160 160 0 0 1 160 160v680a160 160 0 0 1-160 160H160A160 160 0 0 1 0 840V0Z" />
        <path fill="#fff" d="M358.1 920c-64.23-.06-103.86-36.23-103.1-102.79V648.82c0-33.74 9.88-59.4 29.64-76.96 35.49-34.19 117.83-36.27 152.59.52 21.42 18.89 29.5 57.48 27.58 93.49h-73.72c.56-14.15-.19-35.58-8.51-43.65-10.81-14.63-39.36-12.91-46.91 2.32-4.64 8.26-6.96 20.49-6.96 36.67v146.18c0 30.65 10.65 46.15 31.96 46.49 9.96 0 17.53-3.62 22.68-10.85 7.19-8.58 8.31-27.58 7.73-41.32h73.72c5.04 70.07-36.32 119.16-106.71 118.29Zm234.04 0c-71.17.98-103.01-49.66-101.04-118.29h69.59c-1.93 29.92 8.35 57.17 32.99 55.27 10.99 0 18.73-3.44 23.2-10.33 8.5-12.59 10.09-48.95-2.06-63.02-8.49-13.55-39.03-25.51-55.16-33.57-23.03-11.02-39.61-24.1-49.75-39.26-22.87-33.64-20.75-107.48 11.34-137.4 31.18-36.92 112.61-38.62 143.82-.77 19.25 19.51 27.66 57.9 26.03 93.23h-67.02c.57-14.52-.8-37.95-6.44-46.49-3.95-7.23-11.43-10.85-22.42-10.85-19.59 0-29.38 11.71-29.38 35.12.21 24.86 9.9 35.06 32.48 45.45 29.24 11.36 66.42 30.76 79.9 54.24 40.2 71.54 12.62 180.82-86.09 176.65Zm224.76 0c-71.17.98-103.01-49.66-101.04-118.29h69.59c-1.93 29.92 8.35 57.17 32.99 55.27 10.99 0 18.73-3.44 23.2-10.33 8.5-12.59 10.09-48.95-2.06-63.02-8.49-13.55-39.03-25.51-55.16-33.57-23.03-11.02-39.61-24.1-49.75-39.26-22.87-33.64-20.75-107.48 11.34-137.4 31.18-36.92 112.61-38.62 143.82-.77 19.25 19.51 27.66 57.9 26.03 93.23h-67.02c.57-14.52-.8-37.95-6.44-46.49-3.95-7.23-11.43-10.85-22.42-10.85-19.59 0-29.38 11.71-29.38 35.12.21 24.86 9.9 35.06 32.48 45.45 29.24 11.36 66.42 30.76 79.9 54.24 40.2 71.54 12.62 180.82-86.09 176.65Z" />
      </svg>
    </div>
    <div>
      <span>Keep</span>
    </div>
    <div>
      <span>The Web</span>
    </div>
    <div>
      <span>Stylish</span>
    </div>
  </div>
</div>

<!-- for demo purpose -->
<div class="warning">This is an experimental demo for scroll markers made in Chrome Canary, Your browser does not support scroll markers</div>
@import url("https://fonts.googleapis.com/css2?family=Barrio&family=Kablammo&family=Rubik+Puddles&display=swap");

@layer base, carousel, carouselItemsAndMarkers, carouselArrows, squareStyles;

@layer carousel {
  .carousel {
    width: 70%;
    anchor-name: --carousel;
    position: relative;
    margin: 0 auto;
    padding: 0;
    overflow-x: scroll;
    display: grid;
    grid-auto-flow: column;
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    overscroll-behavior: contain;
    scroll-marker-group: after;
    aspect-ratio: 3/1;
    scrollbar-width: none;

    /*     This styles the scorllmarker group, containing the scrollmarkers that hang on the carousel's items */
    &::scroll-marker-group {
      display: grid;
      box-sizing: border-box;
      grid-auto-flow: column;
      margin: 80px auto 0;
      gap: 12px;
      align-items: center;
      justify-content: center;
      padding: 20px;
      border-radius: 10px;
      background: rgb(255 255 255 / 0.3);
      backdrop-filter: blur(1px);
      content: "";
      width: 70%;
      height: 64px;
    }
  }
}

@layer carouselItemsAndMarkers {
  .carousel > * {
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1;
    container-type: inline-size;
    width: auto;
    height: 100%;

    /*     scroll-markers are attached to the items themselves */
    &:nth-child(3n + 2) {
      scroll-snap-stop: always;
      scroll-snap-align: center;
      &::scroll-marker {
        content: "";
        aspect-ratio: 1;
        width: 24px;
        border-radius: 50%;
        border: 1px solid silver;
        cursor: pointer;
        background: transparent;
        justify-content: center;
        transition: background 0.5s ease-out;
        border-color: white;
      }
    }

    /*     use target-current to see if the item is active or not */
    &::scroll-marker:target-current {
      background: fuchsia;
    }
  }
}

@layer squareStyles {
  .carousel div {
    font-family: "Barrio", serif;
    font-weight: 400;
    font-style: normal;
    text-align: center;
    background: oklch(0.73 0.28 339.69);
    color: oklch(0.92 0.22 101.77);
    span {
      font-size: 40cqi;
    }
    &:nth-child(2) {
      background: oklch(0.92 0.22 101.77);
      color: oklch(0.73 0.28 339.69);
    }

    &:nth-child(3) {
      font-family: "Kablammo", serif;
      font-optical-sizing: auto;
      font-weight: 400;
      font-style: normal;
      font-variation-settings: "MORF" 0;
      background: oklch(0.7 0.25 37.17);
      color: oklch(0.35 0.23 266.07);

      span {
        rotate: -8deg;
        font-size: 30cqi;
      }
    }

    &:nth-child(4) {
      font-family: "Kablammo", serif;
      background: oklch(0.56 0.26 259.48);
      color: oklch(0.71 0.24 41.42);
    }

    &:nth-child(5) {
      background: rebeccapurple;
      color: oklch(0.69 0.25 24.42);
    }

    &:nth-child(6) {
      color: rebeccapurple;
    }

    &:nth-child(7) {
      background: oklch(0.87 0.21 165.52);
      color: oklch(0.24 0.1 267.65);
    }

    &:nth-child(8) {
      font-family: "Kablammo", serif;
      background: oklch(0.31 0.1 332.94);
      color: oklch(0.86 0.34 142.6);
      span {
        font-size: 30cqi;
      }
    }

    &:nth-child(9) {
      font-family: "Rubik Puddles", serif;
      background: oklch(0.32 0.11 156.6);
      color: oklch(0.7 0.33 342.92);

      span {
        rotate: -40deg;
        font-size: 23cqi;
      }
    }
  }
}

@layer base {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: radial-gradient(#cfd4c5 20%, transparent 19%),
      radial-gradient(#eecfd4 20%, #e6adec 19%), #f6fedb;
    background-size: 1.4vw 1.4vw;
    background-position: 0 0, 0.7vw 0.7vw;
  }

  .wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    padding: 2vmax;
    background: radial-gradient(rgb(0 0 0 / 0.8) 70%, transparent 30%),
      radial-gradient(rgb(20 20 20 / 0.6) 70%, transparent 15%);
    background-size: 4px 4px;
    background-position: 0 0, 2px 2px;
  }

  svg {
    display: block;
    width: 70cqi;
    aspect-ratio: 1;
    height: auto;
  }
}

.warning {
  background: #ffd503;
  font-family: Helvetica, Arial, sans-serif;
  position: fixed;
  top: 20px;
  left: 20px;
  padding: 20px;
  max-width: 500px;
  border-radius: 5px;
  z-index: 100;
}

@supports (scroll-marker-group: after) {
  .warning {
    display: none;
  }
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.