<select>
  <button>
    <selectedcontent></selectedcontent>
  </button>
  <option value="pokeball">
    <img src="https://assets.codepen.io/159218/pokeball.svg" alt="" />
    Pokeball
  </option>
  <option value="greatball">
    <img src="https://assets.codepen.io/159218/great-ball.svg" alt="" />
    Great ball
  </option>
  <option value="ultraball">
    <img src="https://assets.codepen.io/159218/ultra-ball.svg" alt="" />
    Ultra ball
  </option>
</select>
@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");

@property --hue {
  syntax: "<angle>";
  inherits: true;
  initial-value: 180deg;
}

@keyframes rotateHue {
  0% {
    --hue: 180deg;
  }
  25% {
    --hue: 360deg;
  }
  100% {
    --hue: 180deg;
  }
}

select {
  appearance: none;
  @supports (appearance: base-select) {
    &,
    &::picker(select) {
      appearance: base-select;
      animation: rotateHue 10s infinite;
      animation-play-state: paused;
    }
    &:open {
      animation-play-state: running;
      @media (prefers-reduced-motion) {
        animation-play-state: paused;
      }
    }
  }
}

select {
  display: flex;
  justify-content: space-between;
  min-width: 300px;
  align-items: center;
  color: black;
  padding-block: 10px;
  padding-inline: 20px 30px;
  border-radius: 30px;
  border: 4px solid oklch(54% 0.29 var(--hue));
  cursor: pointer;
  background: oklch(94% 0.49 242)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.5' stroke='%23000' class='size-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E%0A")
    right 10px center / 20px no-repeat;

  @supports (appearance: base-select) {
    padding-inline: 20px;
    background-image: none;
    img {
      width: 30px;
      line-height: 1;
    }
    &::picker-icon {
      content: "";
      width: 20px;
      height: 20px;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.5' stroke='%23000' class='size-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E%0A");
      transition: rotate 0.2s ease-out;
    }
    &:open::picker-icon {
      rotate: 180deg;
    }
    &::picker(select) {
      padding: 0;
      margin-top: 5px;
      border: 4px solid oklch(54% 0.29 var(--hue));
      background: oklch(94% 0.49 242);
      border-radius: 12px;
      font-weight: 400;

      opacity: 0;
      height: 0;
      overflow: clip;
      transition: height 0.5s ease-out, opacity 0.5s ease-out, overlay 0.5s,
        display 0.5s;

      transition-behavior: allow-discrete;
    }
    &:open::picker(select) {
      opacity: 1;
      height: calc-size(auto, size);
      overflow: auto;
      @starting-style {
        opacity: 0;
        height: 0;
      }
    }
    option {
      display: flex;
      align-items: center;
      padding: 10px;
      gap: 10px;
      border-top: 1px solid #444;
      cursor: pointer;
      transition-property: color, background;
      transition-duration: 0.2s;
      transition-timing-function: ease-out;
      &:where(:hover, :focus, :active) {
        background: oklch(24% 0.49 242);
        color: white;
      }
      &:checked {
        background: oklch(10% 0.49 242);
        color: white;
      }
      &::checkmark {
        display: none;
      }
      &:first-child {
        border: 0;
      }
    }
    selectedcontent {
      display: flex;
      align-items: center;
      gap: 10px;
    }
  }
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Poppins", Helvetica, sans-serif;
  background-image: radial-gradient(
    circle,
    oklch(2% 0.36 252),
    oklch(1% 0.35 293)
  );
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.