<!-- Ideally, this is gonna be rendered by backend -->
<!-- But still not practical, so I wouldn't recommend this -->
<div class="backdrop">
  <div class="container">
    <h1>Vegetables</h1>
    <div class="vegetables">
      <ul class="list">
        <li>Carrot</li>
        <li>Tomato</li>
        <li>Broccoli</li>
        <li>Cucumber</li>
        <li>Spinach</li>
      </ul>
      <!-- Page 1 -->

      <ul class="list">
        <li>Potato</li>
        <li>Pepper</li>
        <li>Eggplant</li>
        <li>Lettuce</li>
        <li>Onion</li>
      </ul>
      <!-- Page 2 -->

      <ul class="list">
        <li>Zucchini</li>
        <li>Cauliflower</li>
        <li>Kale</li>
        <li>Cabbage</li>
        <li>Mushroom</li>
      </ul>
      <!-- Page 3 -->

      <ul class="list">
        <li>Asparagus</li>
        <li>Artichoke</li>
        <li>Radish</li>
        <li>Beet</li>
        <li>Okra</li>
      </ul>
      <!-- Page 4 -->

      <ul class="list">
        <li>Brussels Sprouts</li>
        <li>Green Bean</li>
        <li>Butternut Squash</li>
        <li>Turnip</li>
        <li>Chard</li>
      </ul>
      <!-- Page 5 -->
    </div>
    <div class="pagination">
      <span class="page-btn page-step" data-shown="1">&laquo;</span>
      <a href="#page-1" class="page-btn page-step" data-shown="2">&laquo;</a>
      <a href="#page-2" class="page-btn page-step" data-shown="3">&laquo;</a>
      <a href="#page-3" class="page-btn page-step" data-shown="4">&laquo;</a>
      <a href="#page-4" class="page-btn page-step" data-shown="5">&laquo;</a>
      <!-- Previous -->

      <a href="#page-1" id="page-1" class="page-btn">1</a>
      <a href="#page-2" id="page-2" class="page-btn">2</a>
      <a href="#page-3" id="page-3" class="page-btn">3</a>
      <a href="#page-4" id="page-4" class="page-btn">4</a>
      <a href="#page-5" id="page-5" class="page-btn">5</a>
      <!-- Page numbers -->

      <a href="#page-2" class="page-btn page-step" data-shown="1">&raquo;</a>
      <a href="#page-3" class="page-btn page-step" data-shown="2">&raquo;</a>
      <a href="#page-4" class="page-btn page-step" data-shown="3">&raquo;</a>
      <a href="#page-5" class="page-btn page-step" data-shown="4">&raquo;</a>
      <span class="page-btn page-step" data-shown="5">&raquo;</span>
      <!-- Next -->
    </div>
  </div>
</div>
@import url('https://fonts.googleapis.com/css2?family=Gochi+Hand&family=Noto+Color+Emoji&display=swap');

$back-out: cubic-bezier(0.18, 0.89, 0.32, 1.28);

@mixin active() {
  color: #ffffff;
  background-color: #1b95ff;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
}

body {
  font-family: 'Gochi Hand', 'Noto Color Emoji', cursive, sans-serif;
  background-image: url('https://images.unsplash.com/photo-1611693424421-3db00de93a89?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMjM4NDZ8MHwxfHJhbmRvbXx8fHx8fHx8fDE2OTM5MDk1MDd8&ixlib=rb-4.0.3&q=85');
  background-origin: content-box;
  background-position: center;
  background-size: cover;
  width: 100vw;
  height: 100vh;
}

.backdrop {
  background-color: rgba(#ffffff, 0.5);
  width: 100%;
  height: 100%;
  display: flex;
  backdrop-filter: blur(8px);
}

.container {
  background-color: #ffffff;
  padding: 2rem 1rem;
  margin: auto;
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  box-shadow: 0 0.5rem 1rem rgba(#000000, 0.2);

  & > h1 {
    font-size: 2rem;
    text-align: center;
    padding: 1rem;
  }
}

.vegetables {
  width: 100vw;
  max-width: 384px;
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
}

.list {
  width: 100%;
  flex-shrink: 0;
  transition: transform $back-out 512ms;
  
  li {
    text-align: center;
    width: 100%;
    padding: 1rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

.pagination {
  width: 100%;
  padding: 0 1rem;
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  
  &:not(:has(.page-btn:target)) {
    .page-step[data-shown="1"] {
      display: inline-flex;
    }
    
    #page-1 {
      @include active();
    }
  }
}

.page-btn {
  color: #000000;
  width: 2.5rem;
  height: 2.5rem;
  margin-right: 0.25rem;
  display: inline-flex;
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  
  &:last-child {
    margin-right: 0;
  }

  &:is(a) {
    text-decoration: none;
    background-color: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    transition: color 128ms ease-out, background-color 128ms ease-out;
    
    &:not(:target):hover,
    &:not(:target):focus,
    &:not(:target):active, {
      background-color: #dfdfdf;
    }

    &:target {
      @include active();
    }
  }
}

.page-num {
  display: none;
}

.page-step {
  display: none;
}

@for $i from 1 through 5 {
  .container:has(#page-#{$i}:target) {
    & > .vegetables > .list {
      transform: translateX(($i - 1) * -100%);
    }
    
    .page-step[data-shown="#{$i}"] {
      display: inline-flex;
    }
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.