51 CSS Buttons
13 / 51

All 51 in 51 CSS Buttons

  1. 01CSS Submit Button (Form Primary)
  2. 02CSS Primary and Secondary Button Pair
  3. 03CSS Ghost / Outline Button
  4. 04CSS Icon-Only Button with Accessible Tooltip
  5. 05CSS Gradient CTA Button
  6. 06CSS Loading Spinner Button (State Transition)
  7. 07CSS Disabled Button State (Full State Reference)
  8. 08CSS Button Group Component (Segmented Radio-Like)
  9. 09CSS Add to Cart Button
  10. 10CSS Download Progress Button
  11. 11CSS Like Heart Button
  12. 12CSS Confirm Delete Button
  13. 13CSS Play Pause Button
  14. 14CSS Subscribe Confetti Button
  15. 15CSS Magnetic Mercury Ripple Button
  16. 16CSS Brutalist Glitch Button
  17. 17CSS Neon Plasma Burst Button
  18. 18CSS Clay Press Button
  19. 19CSS Editorial Ink Spread Button
  20. 20CSS Particle Shard Burst Button
  21. 21CSS Brushed Brass Plate Button
  22. 22CSS Washi Paper Crane Button
  23. 23CSS Frosted Ice Cube Button
  24. 24CSS Vintage Typewriter Key Button
  25. 25CSS Lacquered Walnut Wood Button
  26. 26CSS Pharma Gel Capsule Button
  27. 27CSS Aged Copper Coin Button
  28. 28CSS Origami Fortune Cookie Button
  29. 29CSS Holographic Foil Sticker Button
  30. 30CSS Brutalist Concrete Slab Button
  31. 31CSS Mercury Bead Morph Button
  32. 32CSS Soft Pill Modern SaaS Button
  33. 33CSS Masking Tape Label Button
  34. 34CSS Obsidian Glass Shard Button
  35. 35CSS Wine Velvet Ribbon Button
  36. 36CSS LED Segment Display Button
  37. 37CSS Cassette Mixtape Label Button
  38. 38CSS Chalkboard Menu Button
  39. 39CSS Vinyl Record Sleeve Ripple Button
  40. 40CSS Polaroid Snapshot Button
  41. 41CSS Airline Boarding Pass Button
  42. 42CSS Aged Brass Subway Token Button
  43. 43CSS Vintage Rx Pharmacy Label Button
  44. 44CSS Bakelite Radio Dial Toggle Button
  45. 45CSS Regal Postage Stamp Button
  46. 46CSS Victorian Cigar Band Foil Button
  47. 47CSS Vintage Calculator Key Button
  48. 48CSS Toolbox Latch Spotlight Button
  49. 49CSS Receipt Paper Total Count-Up Button
  50. 50CSS IBM Punch Card Magnetic Follow Button
  51. 51CSS Brass Periscope Lens Button
Pure CSSMIT licensed

CSS Play Pause Button

One shape that morphs between a play triangle and two pause bars — no icon swap, no SVG library. Both states are clip-path: polygon() with the same point count, so the browser interpolates every vertex; a progress ring sits around it and the whole thing is a single checkbox.

Live Demo
Plain CSSTailwind v4
Try it

Build UI like this from scratch: Flexbox, Grid, animations & responsive CSS

ZTM · The CSS Bootcamp · 30‑day money-back guarantee · Affiliate link

10% off at checkout with code
Check ZTM Course

The code

<div class="cb-13">
  <div class="cb-13__stage">
    <label class="cb-13__btn">
      <input type="checkbox" aria-label="Play or pause the episode">
      <span class="cb-13__ring" aria-hidden="true"></span>
      <span class="cb-13__glyph" aria-hidden="true">
        <span class="cb-13__half cb-13__half--l"></span>
        <span class="cb-13__half cb-13__half--r"></span>
      </span>
    </label>
  </div>
</div>
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700&display=swap');

.cb-13 {
  --bg: #0d0b14;
  --surface: #191426;
  --ink: #f4f1ff;
  --accent: #c084fc;
  --accent-2: #38bdf8;
  --size: 5.5rem;
  --radius: 999px;
  --sans: "Outfit",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  display: block;
  background: radial-gradient(40rem 26rem at 50% 45%, color-mix(in oklab,var(--accent) 16%,transparent), transparent 70%), var(--bg);
  font-family: var(--sans);
}

@supports (color: oklch(50% 0 0)) {
  .cb-13 {
    --accent: oklch(78% .16 305);
    --accent-2: oklch(78% .13 222);
    --surface: oklch(22% .04 295);
  }
}

@media (prefers-color-scheme: light) {
  .cb-13:not([data-theme="dark"]) {
    --bg: #f4f1fb;
    --surface: #ffffff;
    --ink: #1a1230;
    --accent: #7c3aed;
    --accent-2: #0284c7;
  }
}

.cb-13[data-theme="light"] {
  --bg: #f4f1fb;
  --surface: #ffffff;
  --ink: #1a1230;
  --accent: #7c3aed;
  --accent-2: #0284c7;
}

.cb-13,
.cb-13 *,
.cb-13 *::before,
.cb-13 *::after {
  box-sizing: border-box;
}

.cb-13__stage {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(1.5rem,6vw,4rem);
}

.cb-13__btn {
  position: relative;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: var(--radius);
  background: linear-gradient(160deg, color-mix(in oklab,var(--surface) 80%,white 6%), var(--surface));
  box-shadow: inset 0 1px 0 color-mix(in oklab,white 20%,transparent), 0 18px 40px -18px color-mix(in oklab,var(--accent) 70%,transparent);
  transition: scale .4s cubic-bezier(.16,1,.3,1), box-shadow .4s ease;
  -webkit-tap-highlight-color: transparent;
}

.cb-13__btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  clip-path: inset(50%);
}

.cb-13__ring {
  position: absolute;
  inset: -.45rem;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 55%, var(--accent-2), var(--accent), transparent);
  -webkit-mask: radial-gradient(farthest-side,transparent calc(100% - 2.5px),#000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side,transparent calc(100% - 2.5px),#000 calc(100% - 2.5px));
  opacity: .28;
  transition: opacity .4s ease;
}

.cb-13__glyph {
  position: relative;
  width: 42%;
  height: 42%;
  translate: 4% 0;
  transition: translate .5s cubic-bezier(.16,1,.3,1);
}

.cb-13__half {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transition: clip-path .5s cubic-bezier(.16,1,.3,1), background-color .3s ease;
}
/* Play: the triangle split down the middle — the two halves meet seamlessly. */

.cb-13__half--l {
  clip-path: polygon(22% 6%,50% 24%,50% 76%,22% 94%);
}

.cb-13__half--r {
  clip-path: polygon(50% 24%,90% 50%,90% 50%,50% 76%);
}

.cb-13__btn:hover {
  scale: 1.05;
}

.cb-13__btn:active {
  scale: .95;
}

.cb-13__btn:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

.cb-13__btn:has(input:checked) {
  box-shadow: inset 0 1px 0 color-mix(in oklab,white 22%,transparent), 0 22px 50px -18px color-mix(in oklab,var(--accent-2) 80%,transparent);
}

.cb-13__btn:has(input:checked) .cb-13__glyph {
  translate: 0 0;
}
/* Pause: each half becomes its own bar — same four points, so every vertex interpolates. */

.cb-13__btn:has(input:checked) .cb-13__half--l {
  clip-path: polygon(14% 6%,39% 6%,39% 94%,14% 94%);
}

.cb-13__btn:has(input:checked) .cb-13__half--r {
  clip-path: polygon(61% 6%,86% 6%,86% 94%,61% 94%);
}

.cb-13__btn:has(input:checked) .cb-13__ring {
  opacity: 1;
  animation: cb-13-spin 2.6s linear infinite;
}

@keyframes cb-13-spin {
  to {
    rotate: 1turn;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cb-13__btn,
    .cb-13__glyph,
    .cb-13__half,
    .cb-13__ring {
    transition: none;
  }

  .cb-13__btn:has(input:checked) .cb-13__ring {
    animation: none;
    opacity: 1;
  }
}

@media (forced-colors: active) {
  .cb-13__btn {
    border: 1px solid ButtonText;
    background: ButtonFace;
  }

  .cb-13__half {
    background: ButtonText;
  }

  .cb-13__ring {
    display: none;
  }
}
Paste this into ChatGPT, Claude, Cursor, or any coding assistant. The block below is pre-framed with everything the AI needs to integrate this demo into your project — markup, styles, scoping notes, and the source URL. Hit Copy and paste straight into your chat.
Here's a working CSS Button from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: CSS Play Pause Button
Source: https://codefronts.com/components/css-buttons/css-play-pause-button/

One shape that morphs between a play triangle and two pause bars — no icon swap, no SVG library. Both states are clip-path: polygon() with the same point count, so the browser interpolates every vertex; a progress ring sits around it and the whole thing is a single checkbox.
## HTML
```html
<div class="cb-13">
  <div class="cb-13__stage">
    <label class="cb-13__btn">
      <input type="checkbox" aria-label="Play or pause the episode">
      <span class="cb-13__ring" aria-hidden="true"></span>
      <span class="cb-13__glyph" aria-hidden="true">
        <span class="cb-13__half cb-13__half--l"></span>
        <span class="cb-13__half cb-13__half--r"></span>
      </span>
    </label>
  </div>
</div>
```
## CSS
```css
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700&display=swap');

.cb-13 {
  --bg: #0d0b14;
  --surface: #191426;
  --ink: #f4f1ff;
  --accent: #c084fc;
  --accent-2: #38bdf8;
  --size: 5.5rem;
  --radius: 999px;
  --sans: "Outfit",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  display: block;
  background: radial-gradient(40rem 26rem at 50% 45%, color-mix(in oklab,var(--accent) 16%,transparent), transparent 70%), var(--bg);
  font-family: var(--sans);
}

@supports (color: oklch(50% 0 0)) {
  .cb-13 {
    --accent: oklch(78% .16 305);
    --accent-2: oklch(78% .13 222);
    --surface: oklch(22% .04 295);
  }
}

@media (prefers-color-scheme: light) {
  .cb-13:not([data-theme="dark"]) {
    --bg: #f4f1fb;
    --surface: #ffffff;
    --ink: #1a1230;
    --accent: #7c3aed;
    --accent-2: #0284c7;
  }
}

.cb-13[data-theme="light"] {
  --bg: #f4f1fb;
  --surface: #ffffff;
  --ink: #1a1230;
  --accent: #7c3aed;
  --accent-2: #0284c7;
}

.cb-13,
.cb-13 *,
.cb-13 *::before,
.cb-13 *::after {
  box-sizing: border-box;
}

.cb-13__stage {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(1.5rem,6vw,4rem);
}

.cb-13__btn {
  position: relative;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: var(--radius);
  background: linear-gradient(160deg, color-mix(in oklab,var(--surface) 80%,white 6%), var(--surface));
  box-shadow: inset 0 1px 0 color-mix(in oklab,white 20%,transparent), 0 18px 40px -18px color-mix(in oklab,var(--accent) 70%,transparent);
  transition: scale .4s cubic-bezier(.16,1,.3,1), box-shadow .4s ease;
  -webkit-tap-highlight-color: transparent;
}

.cb-13__btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  clip-path: inset(50%);
}

.cb-13__ring {
  position: absolute;
  inset: -.45rem;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 55%, var(--accent-2), var(--accent), transparent);
  -webkit-mask: radial-gradient(farthest-side,transparent calc(100% - 2.5px),#000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side,transparent calc(100% - 2.5px),#000 calc(100% - 2.5px));
  opacity: .28;
  transition: opacity .4s ease;
}

.cb-13__glyph {
  position: relative;
  width: 42%;
  height: 42%;
  translate: 4% 0;
  transition: translate .5s cubic-bezier(.16,1,.3,1);
}

.cb-13__half {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transition: clip-path .5s cubic-bezier(.16,1,.3,1), background-color .3s ease;
}
/* Play: the triangle split down the middle — the two halves meet seamlessly. */

.cb-13__half--l {
  clip-path: polygon(22% 6%,50% 24%,50% 76%,22% 94%);
}

.cb-13__half--r {
  clip-path: polygon(50% 24%,90% 50%,90% 50%,50% 76%);
}

.cb-13__btn:hover {
  scale: 1.05;
}

.cb-13__btn:active {
  scale: .95;
}

.cb-13__btn:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

.cb-13__btn:has(input:checked) {
  box-shadow: inset 0 1px 0 color-mix(in oklab,white 22%,transparent), 0 22px 50px -18px color-mix(in oklab,var(--accent-2) 80%,transparent);
}

.cb-13__btn:has(input:checked) .cb-13__glyph {
  translate: 0 0;
}
/* Pause: each half becomes its own bar — same four points, so every vertex interpolates. */

.cb-13__btn:has(input:checked) .cb-13__half--l {
  clip-path: polygon(14% 6%,39% 6%,39% 94%,14% 94%);
}

.cb-13__btn:has(input:checked) .cb-13__half--r {
  clip-path: polygon(61% 6%,86% 6%,86% 94%,61% 94%);
}

.cb-13__btn:has(input:checked) .cb-13__ring {
  opacity: 1;
  animation: cb-13-spin 2.6s linear infinite;
}

@keyframes cb-13-spin {
  to {
    rotate: 1turn;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cb-13__btn,
    .cb-13__glyph,
    .cb-13__half,
    .cb-13__ring {
    transition: none;
  }

  .cb-13__btn:has(input:checked) .cb-13__ring {
    animation: none;
    opacity: 1;
  }
}

@media (forced-colors: active) {
  .cb-13__btn {
    border: 1px solid ButtonText;
    background: ButtonFace;
  }

  .cb-13__half {
    background: ButtonText;
  }

  .cb-13__ring {
    display: none;
  }
}
```

How this works

Interpolating a clip-path requires identical shape functions and identical point counts — and, crucially, one continuous outline per element. Two bars cannot be a single polygon, so the glyph is split into two halves that each morph between four points:

/* play — the triangle, cut down the middle */
.cb-13__half--l{ clip-path:polygon(22% 6%,50% 24%,50% 76%,22% 94%); }
.cb-13__half--r{ clip-path:polygon(50% 24%,90% 50%,90% 50%,50% 76%); }

/* pause — each half becomes a bar */
:checked ~ * .cb-13__half--l{ clip-path:polygon(14% 6%,39% 6%,39% 94%,14% 94%); }
:checked ~ * .cb-13__half--r{ clip-path:polygon(61% 6%,86% 6%,86% 94%,61% 94%); }

The right half doubles its apex vertex so both halves keep four points in both states. In play mode the two clips share the edge at 50%, so the triangle looks like one solid shape. The ring around it is a conic gradient masked to a 2px annulus that spins only while playing, and the button's own scale springs on toggle.

The control is an <input type="checkbox"> with an aria-label; for a real player, mirror the state onto the audio element and keep the label current ("Play" / "Pause") from JS.

Make it yours

  • Resize with one token: --size scales the button, glyph, ring and focus ring together.
  • Change ring behaviour to real progress by feeding a registered --p percentage into the conic gradient (see demo 10).
  • For a square media button set --radius:1.1rem; the glyph is unaffected.
  • Add a stop state by giving each half a square polygon (four points, so it still interpolates) behind a second state class.
  • Slow the morph to .8s for a cinematic player, or .22s for a podcast app.

Gotchas — read before shipping

  • clip-path only animates between the same function with the same number of points — mixing inset() and polygon(), or 3 points and 8, snaps instantly.
  • A single polygon() cannot describe two separate bars. Writing the pause state as one self-intersecting outline renders a bowtie/X, not two rectangles — nonzero fills the crossing, it does not split the shape. Use one element per bar, as here.
  • The glyph must be a solid coloured box; clip-path cuts a shape out of it and cannot add colour.
  • A play/pause control must announce its current state. With a checkbox, "checked" carries it; with a <button> you need aria-pressed or a changing aria-label, never both.
  • Never rely on the spinning ring to indicate playback — audio may be muted and motion may be disabled.
  • Center the glyph optically, not mathematically: a play triangle needs ~1px of extra left padding or it reads off-centre.

Browser support

ChromeSafariFirefoxEdge
111+16.2+121+111+

Floor set by :has(), oklch(), color-mix() as this demo is written. The core technique itself goes back further — Chrome 105+.

clip-path polygon interpolation is supported everywhere relevant (Chrome 55 / Safari 9.1 / Firefox 54). :has() needs Chrome 105 / Safari 15.4 / Firefox 121; without it swap to the sibling-combinator form.

Techniques used in this demo

Search CodeFronts

Loading…