16 CSS Floating Action Button Designs
A floating action button (FAB) is a circular or pill-shaped button that hovers above the page in a fixed position — usually the bottom-right corner — to surface the single most important action on a screen. These 16 hand-coded patterns cover every common variant: simple plus button, expanding speed dial, pulse / attention-grabber, morphing search, labeled pill, scroll-to-top, glass and neon effects, notification badge, voice-action mic, drag handle, quick-reply reactions and more. Every demo is pure HTML + CSS (a few add minimal JS for live state), uses real `<button>` elements with proper ARIA, and is ready to copy into any project.
16 hand-coded CSS floating action button (FAB) designs — classic plus, speed dial, pulse ring, morphing search, labeled pill, scroll-to-top, neon, glass, brutalist, notification badge, loading spinner, drag handle, voice action, premium aurora, quick reply reactions, squircle modern. Every demo uses real <button> elements, semantic ARIA, scoped class-based CSS, and JavaScript only where it adds real interaction.
.cfb-classic {
width: 56px; height: 56px;
border: 0; border-radius: 50%;
background: linear-gradient(135deg, #7c6cff, #a78bfa);
color: #fff;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 6px 16px rgba(124,108,255,0.35);
transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s, filter 0.2s;
}
.cfb-classic:hover {
transform: translateY(-3px);
box-shadow: 0 12px 28px rgba(124,108,255,0.5);
filter: brightness(1.05);
}
.cfb-classic:active { transform: translateY(-1px); }
.cfb-classic:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cfb-classic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; } <button type="button" class="cfb-classic" aria-label="Create new"> <svg viewBox="0 0 24 24" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> </button>
.cfb-dial {
position: relative;
width: 56px; height: 56px;
}
.cfb-dial button {
position: absolute;
width: 48px; height: 48px;
border-radius: 50%; border: 0; cursor: pointer;
display: flex; align-items: center; justify-content: center;
font-size: 20px;
transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), background 0.2s, opacity 0.25s;
}
.cfb-dial-main {
z-index: 2;
bottom: 0; left: 0;
background: linear-gradient(135deg, #ff6c8a, #ff9a76);
color: #fff;
font: 700 26px/1 system-ui, sans-serif;
box-shadow: 0 6px 18px rgba(255,108,138,0.4);
}
.cfb-dial:hover .cfb-dial-main,
.cfb-dial:focus-within .cfb-dial-main { transform: rotate(45deg); }
.cfb-dial-c {
z-index: 1;
bottom: 0; left: 0;
background: #1a1a28;
border: 1px solid rgba(255,255,255,0.1);
font-size: 16px;
opacity: 0;
pointer-events: none;
}
.cfb-dial:hover .cfb-dial-c,
.cfb-dial:focus-within .cfb-dial-c { opacity: 1; pointer-events: auto; }
.cfb-dial:hover .cfb-dial-c1,
.cfb-dial:focus-within .cfb-dial-c1 { transform: translateY(-60px); }
.cfb-dial:hover .cfb-dial-c2,
.cfb-dial:focus-within .cfb-dial-c2 { transform: translate(48px, -42px); }
.cfb-dial:hover .cfb-dial-c3,
.cfb-dial:focus-within .cfb-dial-c3 { transform: translateX(60px); }
.cfb-dial button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; } <div class="cfb-dial" role="group" aria-label="Quick create"> <button type="button" class="cfb-dial-main" aria-label="Open quick actions" aria-expanded="false">+</button> <button type="button" class="cfb-dial-c cfb-dial-c1" aria-label="New document">📄</button> <button type="button" class="cfb-dial-c cfb-dial-c2" aria-label="New folder">📁</button> <button type="button" class="cfb-dial-c cfb-dial-c3" aria-label="Upload file">⬆</button> </div>
.cfb-pulse {
position: relative;
width: 52px; height: 52px;
border: 0; border-radius: 50%;
background: linear-gradient(135deg, #ff6c8a, #f5a623);
color: #fff;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 4px 14px rgba(255,108,138,0.4);
}
.cfb-pulse::before, .cfb-pulse::after {
content: '';
position: absolute; inset: 0;
border-radius: 50%;
border: 2px solid rgba(255,108,138,0.55);
animation: cfb-pulse-ring 1.8s ease-out infinite;
}
.cfb-pulse::after { animation-delay: 0.9s; }
@keyframes cfb-pulse-ring {
0% { transform: scale(1); opacity: 1; }
100% { transform: scale(1.7); opacity: 0; }
}
.cfb-pulse:hover { filter: brightness(1.08); }
.cfb-pulse:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.cfb-pulse svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; } <button type="button" class="cfb-pulse" aria-label="What's new"> <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2v6m0 0a4 4 0 0 0-4 4v3.5L6 17h12l-2-1.5V12a4 4 0 0 0-4-4z"/><path d="M9 17a3 3 0 0 0 6 0"/></svg> </button>
.cfb-morph {
position: relative;
display: inline-block;
height: 52px;
}
.cfb-morph input {
width: 52px; height: 52px;
padding: 0 16px 0 48px;
border: 0; outline: none;
background: linear-gradient(135deg, #2eb88a, #06b6d4);
border-radius: 26px;
color: #fff;
font: 500 14px/52px system-ui, sans-serif;
box-shadow: 0 6px 16px rgba(46,184,138,0.35);
cursor: pointer;
transition: width 0.4s cubic-bezier(0.65,0,0.35,1), padding 0.4s, background 0.3s;
}
.cfb-morph input::placeholder { color: rgba(255,255,255,0.7); }
.cfb-morph:hover input,
.cfb-morph input:focus { width: 240px; cursor: text; }
.cfb-morph-icon {
position: absolute; top: 50%; left: 16px;
transform: translateY(-50%);
pointer-events: none;
}
.cfb-morph-icon svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; } <form class="cfb-morph" role="search">
<input type="search" placeholder="Search…" aria-label="Search" />
<span class="cfb-morph-icon" aria-hidden="true">
<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>
</span>
</form> .cfb-pill {
display: inline-flex; align-items: center; gap: 8px;
padding: 14px 22px 14px 18px;
border: 0; border-radius: 999px;
background: linear-gradient(135deg, #7c6cff, #ff6c8a);
color: #fff;
font: 600 14px/1 system-ui, sans-serif;
cursor: pointer;
box-shadow: 0 6px 18px rgba(124,108,255,0.35);
transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s, filter 0.2s;
}
.cfb-pill:hover {
transform: translateY(-2px);
box-shadow: 0 10px 24px rgba(124,108,255,0.45);
filter: brightness(1.05);
}
.cfb-pill:active { transform: translateY(0); }
.cfb-pill:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cfb-pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; } <button type="button" class="cfb-pill"> <svg viewBox="0 0 24 24" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg> <span>New project</span> </button>
.cfb-top {
display: inline-flex; align-items: center; justify-content: center;
width: 48px; height: 48px;
background: #1a1a28;
border: 1px solid rgba(255,255,255,0.1);
border-radius: 12px;
color: #cbd5e1;
text-decoration: none;
cursor: pointer;
box-shadow: 0 4px 14px rgba(0,0,0,0.4);
transition: transform 0.25s, background 0.2s, border-color 0.2s, color 0.2s;
}
.cfb-top:hover {
transform: translateY(-4px);
background: rgba(124,108,255,0.12);
border-color: rgba(124,108,255,0.4);
color: #a78bfa;
animation: cfb-top-bounce 0.6s ease-in-out infinite alternate;
}
.cfb-top:focus-visible { outline: 2px solid #7c6cff; outline-offset: 3px; }
.cfb-top svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
@keyframes cfb-top-bounce {
from { transform: translateY(-4px); }
to { transform: translateY(-7px); }
} <a href="#top" class="cfb-top" aria-label="Back to top"> <svg viewBox="0 0 24 24" aria-hidden="true"><polyline points="18 15 12 9 6 15"/></svg> </a>
.cfb-neon {
width: 56px; height: 56px;
border: 1.5px solid #6cffff;
border-radius: 50%;
background: rgba(10,0,20,0.85);
color: #6cffff;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 0 12px rgba(108,255,255,0.4), inset 0 0 8px rgba(108,255,255,0.15);
transition: box-shadow 0.25s, color 0.25s, border-color 0.25s, transform 0.2s;
}
.cfb-neon:hover {
border-color: #ff6cff;
color: #ff6cff;
box-shadow: 0 0 24px rgba(255,108,255,0.7), 0 0 48px rgba(255,108,255,0.3), inset 0 0 12px rgba(255,108,255,0.2);
transform: scale(1.05);
}
.cfb-neon:focus-visible { outline: 2px solid #ff6cff; outline-offset: 4px; }
.cfb-neon svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 1; stroke-linejoin: round; } <button type="button" class="cfb-neon" aria-label="Execute"> <svg viewBox="0 0 24 24" aria-hidden="true"><polygon points="6 4 20 12 6 20 6 4"/></svg> </button>
.cfb-glass-bg {
display: inline-flex;
padding: 24px;
border-radius: 16px;
background: linear-gradient(135deg, #2a1a4a 0%, #4a2a6a 50%, #ff6c8a 100%);
}
.cfb-glass {
width: 52px; height: 52px;
border: 1px solid rgba(255,255,255,0.25);
border-radius: 50%;
background: rgba(255,255,255,0.12);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
color: #fff;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 8px 24px rgba(0,0,0,0.25);
transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.cfb-glass:hover {
background: rgba(255,255,255,0.22);
border-color: rgba(255,255,255,0.45);
transform: translateY(-2px);
}
.cfb-glass:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cfb-glass svg { width: 20px; height: 20px; fill: currentColor; } <div class="cfb-glass-bg">
<button type="button" class="cfb-glass" aria-label="Quick action">
<svg viewBox="0 0 24 24" aria-hidden="true"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>
</button>
</div> .cfb-brut {
display: inline-flex; align-items: center; justify-content: center;
padding: 16px 22px;
border: 2.5px solid #1a1a2e;
background: #f0eeff;
color: #1a1a2e;
font: 800 14px/1 'Courier New', monospace;
letter-spacing: 0.14em;
cursor: pointer;
box-shadow: 6px 6px 0 #ff6c8a;
transition: transform 0.1s, box-shadow 0.1s;
}
.cfb-brut:hover { transform: translate(-1px,-1px); box-shadow: 7px 7px 0 #ff6c8a; }
.cfb-brut:active,
.cfb-brut:focus-visible { transform: translate(6px,6px); box-shadow: 0 0 0 #ff6c8a; outline: none; } <button type="button" class="cfb-brut"> <span>NEW</span> </button>
.cfb-badge {
position: relative;
width: 52px; height: 52px;
border: 0; border-radius: 50%;
background: linear-gradient(135deg, #06b6d4, #0ea5e9);
color: #fff;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 6px 16px rgba(6,182,212,0.35);
transition: transform 0.25s, box-shadow 0.25s;
}
.cfb-badge:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(6,182,212,0.5); }
.cfb-badge:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cfb-badge svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cfb-badge-dot {
position: absolute; top: -4px; right: -4px;
min-width: 22px; height: 22px;
padding: 0 6px; border-radius: 999px;
background: #ff5d6c;
color: #fff;
font: 700 11px/22px 'JetBrains Mono', monospace;
text-align: center;
border: 2px solid #111118;
box-shadow: 0 0 0 0 rgba(255,93,108,0.7);
animation: cfb-badge-ping 1.6s ease-out infinite;
}
@keyframes cfb-badge-ping {
0%,100% { box-shadow: 0 0 0 0 rgba(255,93,108,0.6); }
50% { box-shadow: 0 0 0 8px rgba(255,93,108,0); }
} <button type="button" class="cfb-badge" aria-label="Inbox, 3 unread"> <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M22 2 11 13"/><path d="m22 2-7 20-4-9-9-4 20-7z"/></svg> <span class="cfb-badge-dot" aria-hidden="true">3</span> </button>
.cfb-load {
position: relative;
width: 52px; height: 52px;
border: 0; border-radius: 50%;
background: linear-gradient(135deg, #2eb88a, #06b6d4);
color: #fff;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 6px 16px rgba(46,184,138,0.35);
transition: transform 0.2s, opacity 0.2s;
}
.cfb-load:hover { transform: translateY(-2px); }
.cfb-load:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cfb-load:disabled { cursor: wait; opacity: 0.85; }
.cfb-load svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: opacity 0.2s; }
.cfb-load-spin {
position: absolute; inset: 14px;
border: 2px solid rgba(255,255,255,0.3);
border-top-color: #fff;
border-radius: 50%;
opacity: 0;
animation: cfb-load-rot 0.7s linear infinite;
}
.cfb-load.is-loading .cfb-load-icon { opacity: 0; }
.cfb-load.is-loading .cfb-load-spin { opacity: 1; }
@keyframes cfb-load-rot { to { transform: rotate(360deg); } } <button type="button" class="cfb-load" aria-label="Save changes" data-cfb-load> <svg class="cfb-load-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg> <span class="cfb-load-spin" aria-hidden="true"></span> </button>
// Loading FAB — click triggers spinner state, returns to ready after 1.5s
document.querySelectorAll('[data-cfb-load]').forEach(function (btn) {
btn.addEventListener('click', function () {
if (btn.classList.contains('is-loading')) return;
btn.classList.add('is-loading');
btn.disabled = true;
setTimeout(function () {
btn.classList.remove('is-loading');
btn.disabled = false;
}, 1500);
});
}); .cfb-drag {
width: 44px; height: 44px;
border: 1px solid rgba(255,255,255,0.1);
border-radius: 12px;
background: #1a1a28;
color: #9d9bbf;
cursor: grab;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}
.cfb-drag:hover {
background: rgba(124,108,255,0.1);
border-color: rgba(124,108,255,0.4);
color: #a78bfa;
}
.cfb-drag:active { cursor: grabbing; transform: scale(0.95); }
.cfb-drag:focus-visible { outline: 2px solid #7c6cff; outline-offset: 3px; }
.cfb-drag svg { width: 18px; height: 18px; fill: currentColor; } <button type="button" class="cfb-drag" aria-label="Drag to reposition"> <svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg> </button>
.cfb-voice {
position: relative;
width: 56px; height: 56px;
border: 0; border-radius: 50%;
background: #1a1a28;
border: 1px solid rgba(255,255,255,0.12);
color: #a78bfa;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 4px 14px rgba(0,0,0,0.35);
transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.cfb-voice:hover { background: #1f1f2e; border-color: rgba(167,139,250,0.4); }
.cfb-voice:focus-visible { outline: 2px solid #7c6cff; outline-offset: 3px; }
.cfb-voice svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.cfb-voice[aria-pressed="true"] {
background: linear-gradient(135deg, #ff6c8a, #ff5d6c);
border-color: transparent;
color: #fff;
}
.cfb-voice[aria-pressed="true"]::before,
.cfb-voice[aria-pressed="true"]::after {
content: '';
position: absolute; inset: 0;
border-radius: 50%;
border: 2px solid rgba(255,108,138,0.6);
animation: cfb-voice-pulse 1.4s ease-out infinite;
}
.cfb-voice[aria-pressed="true"]::after { animation-delay: 0.7s; }
@keyframes cfb-voice-pulse {
0% { transform: scale(1); opacity: 1; }
100% { transform: scale(1.6); opacity: 0; }
} <button type="button" class="cfb-voice" aria-label="Start voice input" aria-pressed="false" data-cfb-voice> <svg viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/></svg> </button>
// Voice FAB — toggle aria-pressed (mock recording state for the demo)
document.querySelectorAll('[data-cfb-voice]').forEach(function (btn) {
btn.addEventListener('click', function () {
var on = btn.getAttribute('aria-pressed') === 'true';
btn.setAttribute('aria-pressed', on ? 'false' : 'true');
btn.setAttribute('aria-label', on ? 'Start voice input' : 'Stop voice input');
// Hook real Web Speech API here:
// const rec = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
});
}); .cfb-aurora {
position: relative;
width: 56px; height: 56px;
border: 0; border-radius: 50%;
background: #15151d;
color: #fff;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
overflow: hidden;
isolation: isolate;
box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}
.cfb-aurora::before {
content: ''; position: absolute;
top: -40%; left: -20%;
width: 140%; height: 220%;
background:
radial-gradient(ellipse 60px 50px at 20% 50%, rgba(124,108,255,0.7), transparent 60%),
radial-gradient(ellipse 50px 40px at 60% 50%, rgba(255,108,138,0.6), transparent 60%),
radial-gradient(ellipse 60px 50px at 100% 50%, rgba(46,204,138,0.45), transparent 60%);
filter: blur(8px);
z-index: -1;
animation: cfb-aurora-drift 14s ease-in-out infinite;
}
.cfb-aurora:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(124,108,255,0.4); }
.cfb-aurora:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cfb-aurora svg { width: 22px; height: 22px; fill: currentColor; filter: drop-shadow(0 0 4px rgba(255,255,255,0.4)); }
@keyframes cfb-aurora-drift {
0%, 100% { transform: translateX(0) translateY(0); }
50% { transform: translateX(-8%) translateY(2%); }
} <button type="button" class="cfb-aurora" aria-label="Upgrade"> <svg viewBox="0 0 24 24" aria-hidden="true"><polygon points="12 2 15 8 22 9 17 14 18 21 12 18 6 21 7 14 2 9 9 8 12 2"/></svg> </button>
.cfb-reply {
position: relative;
}
.cfb-reply-main {
width: 48px; height: 48px;
border: 0; border-radius: 50%;
background: linear-gradient(135deg, #f5a623, #ff6c8a);
color: #fff;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 4px 14px rgba(245,166,35,0.35);
transition: transform 0.2s;
}
.cfb-reply-main:hover { transform: scale(1.05); }
.cfb-reply-main:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cfb-reply-main svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cfb-reply-pop {
position: absolute;
bottom: calc(100% + 10px); left: 50%;
transform: translateX(-50%) scale(0.6);
display: flex; gap: 4px;
padding: 6px;
background: #1a1a28;
border: 1px solid rgba(255,255,255,0.12);
border-radius: 999px;
box-shadow: 0 8px 24px rgba(0,0,0,0.4);
opacity: 0; pointer-events: none;
transform-origin: center bottom;
transition: opacity 0.2s, transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.cfb-reply:hover .cfb-reply-pop,
.cfb-reply:focus-within .cfb-reply-pop {
opacity: 1; pointer-events: auto;
transform: translateX(-50%) scale(1);
}
.cfb-reply-pop button {
width: 36px; height: 36px;
border: 0; border-radius: 50%;
background: transparent;
font-size: 18px;
cursor: pointer;
transition: transform 0.15s, background 0.15s;
}
.cfb-reply-pop button:hover {
transform: scale(1.25);
background: rgba(255,255,255,0.08);
}
.cfb-reply-pop button:focus-visible { outline: 2px solid #f5a623; outline-offset: 2px; } <div class="cfb-reply">
<button type="button" class="cfb-reply-main" aria-label="React with emoji" aria-haspopup="true" aria-expanded="false">
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01"/></svg>
</button>
<div class="cfb-reply-pop" role="group" aria-label="Reactions">
<button type="button" aria-label="Like">👍</button>
<button type="button" aria-label="Love">❤️</button>
<button type="button" aria-label="Laugh">😂</button>
<button type="button" aria-label="Celebrate">🎉</button>
</div>
</div> .cfb-square {
width: 56px; height: 56px;
border: 0; border-radius: 18px;
background: linear-gradient(135deg, #1f1f2e, #15151d);
color: #cbd5e1;
cursor: pointer;
display: flex; align-items: center; justify-content: center;
border: 1px solid rgba(255,255,255,0.08);
box-shadow: 0 8px 24px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s, color 0.2s, border-color 0.2s;
}
.cfb-square:hover {
transform: rotate(-6deg) translateY(-3px);
color: #a78bfa;
border-color: rgba(167,139,250,0.4);
box-shadow: 0 12px 32px rgba(124,108,255,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
}
.cfb-square:active { transform: rotate(0) translateY(0); }
.cfb-square:focus-visible { outline: 2px solid #7c6cff; outline-offset: 3px; }
.cfb-square svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; } <button type="button" class="cfb-square" aria-label="Compose"> <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 20h9M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg> </button>
Frequently asked questions
What is a floating action button (FAB)?
When should I use a FAB on my site?
Can these floating action buttons be used in any framework?
Are the FAB designs accessible and mobile-friendly?
Do I need JavaScript to use these floating buttons?
Related collections
22 CSS Button Group Designs
22 hand-coded CSS button group designs — segmented pill, connected outline, filter chips, split action, toggle, pagination, stepper wizard, view switcher, FAB, brutalist, glass, neon, date range, approve / reject, icon toolbar, dropdown combo, action group, number stepper, tab nav, aurora drift. Semantic HTML, accessible, copy-paste ready.
31 CSS Buttons
31 hand-coded CSS buttons — gradients, glassmorphism, 3D press, neon glow, ripple, glitch, shimmer, rainbow border and more. Pure CSS, copy-paste ready.
20 CSS Cards with Animations
20 hand-crafted CSS card components — aurora glow, 3D tilt, glassmorphism, neon borders, flip card, pricing, terminal, music player, weather widget and more.