18 CSS Play / Pause Button Designs
Floating FAB
Material-style floating action button with elevation that lifts on hover and presses down on click. The icon morphs between play and pause — a polished pattern for full-screen video and tutorial overlays.
Floating FAB the 12th of 18 designs in the 18 CSS Play / Pause Button Designs collection. The design pairs CSS styling with a small amount of JavaScript for interactivity. Copy the HTML, CSS and JavaScript panels below into your project — the JS is self-contained, has zero dependencies, and is safe to drop into any framework (React, Vue, Svelte, plain HTML). The design honours prefers-reduced-motion and uses real semantic markup, so it ships accessibility-ready out of the box.
Live preview
The code
<button class="pp-fab" type="button" aria-pressed="false" aria-label="Play" data-pp>
<svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true">
<path class="pp-fab-icon" d="M8 5 L8 19 L19 12 Z" fill="currentColor" />
</svg>
</button> .pp-fab {
width: 64px;
height: 64px;
border-radius: 50%;
background: linear-gradient(135deg, #6366f1, #4f46e5);
border: 0;
color: white;
display: grid;
place-items: center;
cursor: pointer;
box-shadow:
0 1px 2px rgba(0, 0, 0, 0.2),
0 4px 8px rgba(0, 0, 0, 0.18),
0 12px 24px -4px rgba(99, 102, 241, 0.5);
transition:
box-shadow 0.25s,
transform 0.15s,
background 0.25s;
}
.pp-fab:hover {
transform: translateY(-3px);
box-shadow:
0 2px 4px rgba(0, 0, 0, 0.25),
0 8px 16px rgba(0, 0, 0, 0.2),
0 22px 36px -6px rgba(99, 102, 241, 0.6);
}
.pp-fab:active {
transform: translateY(0);
box-shadow:
0 1px 2px rgba(0, 0, 0, 0.2),
0 2px 4px rgba(0, 0, 0, 0.18),
0 4px 8px -2px rgba(99, 102, 241, 0.45);
}
.pp-fab:focus-visible {
outline: 3px solid rgba(99, 102, 241, 0.5);
outline-offset: 4px;
}
.pp-fab[aria-pressed="true"] {
background: linear-gradient(135deg, #4f46e5, #4338ca);
}
.pp-fab-icon {
transition: d 0.35s cubic-bezier(0.5, 0, 0.3, 1.2);
}
.pp-fab[aria-pressed="true"] .pp-fab-icon {
d: path("M7 5 H10 V19 H7 Z M14 5 H17 V19 H14 Z");
} // ── Drop this on every page where you render a play/pause button ──
// Toggles aria-pressed + aria-label on click. The CSS handles all visuals.
document.querySelectorAll('[data-pp]').forEach(function (btn) {
btn.addEventListener('click', function () {
var playing = btn.getAttribute('aria-pressed') === 'true';
btn.setAttribute('aria-pressed', String(!playing));
btn.setAttribute('aria-label', !playing ? 'Pause' : 'Play');
});
}); More from 18 CSS Play / Pause Button Designs
Gradient DiscVoice MemoProgress RingMagnetic HoverLiquid DropRipple on ClickCassette TapeLive BadgeMorph TriangleVinyl RecordEqualiser BarsSkip Hub
View the full collection →