Liquid Glass Button
A translucent glass button whose highlight follows the pointer and which squishes when pressed.
AI prompt
Create a glass button on a soft colourful background (blurry indigo, coral and mint shapes). The button is a 48px tall pill with backdrop-filter blur(14px) saturate(1.4), a rgba(255,255,255,0.28) fill, a 1px rgba(255,255,255,0.7) border and an inset highlight (inset 0 1px 0 rgba(255,255,255,.8)). Add a radial-gradient highlight layer positioned with CSS custom properties --x and --y set from pointermove (percent of the button) at 45 percent white opacity that fades in on hover. On press scale to 0.96 in 140ms cubic-bezier(.3,1.4,.5,1) and darken the tint. The label is 14px semibold dark text with strong contrast. Keep a 2px focus-visible ring outside the border. Track the pointer only for mouse or pen. Under prefers-reduced-motion disable tracking and scaling and use only a tint change. Provide a solid white fallback with @supports not (backdrop-filter: blur(1px)).About this pattern
Definition
A button made of blurred, translucent material with a thin bright edge and a soft highlight that moves toward the pointer. Pressing it compresses it slightly, as if it were a physical, slightly elastic object.
Purpose & UX principles
- Gives controls a tactile, material presence on rich backgrounds such as photos and gradients.
- Legibility comes first: the label sits on a tint strong enough for 4.5:1 contrast, and the effect never carries meaning on its own.
- Provide a solid fallback where backdrop blur is unavailable.
Interaction states
- Rest, hover (highlight follows the pointer, edge brightens), pressed (scale 0.96 and a darker tint), focus-visible (outer ring), disabled.
Motion specification
- The highlight position updates every frame; scale on press 140ms cubic-bezier(.3,1.4,.5,1).
- Reduced motion: no highlight tracking and no scale, only a tint change.
Responsive behaviour
- 48px tall, at least 120px wide; the highlight effect is pointer-only and disabled on touch.
- The effect is cheap: only custom properties change.
Code
<div class="bg"><i class="b1"></i><i class="b2"></i><i class="b3"></i><button class="gb" id="gb"><span class="hl"></span><span class="lb">Continue</span></button></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
.bg{position:relative;width:min(300px,100%);height:150px;border-radius:14px;overflow:hidden;background:#f3efe9;display:grid;place-items:center}
.bg i{position:absolute;border-radius:50%;filter:blur(2px)}
.b1{width:110px;height:110px;left:14px;top:-10px;background:#8f9cf5}.b2{width:90px;height:90px;right:18px;top:46px;background:#f58f8f}.b3{width:80px;height:80px;left:100px;bottom:-24px;background:#8fe0c0}
.gb{--x:50%;--y:50%;position:relative;z-index:1;height:48px;min-width:132px;padding:0 26px;border-radius:99px;border:1px solid rgba(255,255,255,.7);background:rgba(255,255,255,.28);backdrop-filter:blur(14px) saturate(1.4);-webkit-backdrop-filter:blur(14px) saturate(1.4);box-shadow:inset 0 1px 0 rgba(255,255,255,.8),0 8px 24px rgba(0,0,0,.12);font:inherit;font-size:14px;font-weight:600;color:#171717;cursor:pointer;overflow:hidden;transition:transform .14s cubic-bezier(.3,1.4,.5,1),background .15s}
.hl{position:absolute;inset:0;background:radial-gradient(circle at var(--x) var(--y),rgba(255,255,255,.55),transparent 55%);opacity:0;transition:opacity .2s}
.gb:hover .hl{opacity:1}
.lb{position:relative}
.gb:active{transform:scale(.96);background:rgba(255,255,255,.18)}
.gb:focus-visible{outline:2px solid #171717;outline-offset:3px}
@supports not (backdrop-filter:blur(1px)){.gb{background:#fff}}
@media (prefers-reduced-motion:reduce){.gb{transition:background .15s}.gb:active{transform:none}.hl{display:none}}const gb=document.getElementById('gb');
if(!matchMedia('(prefers-reduced-motion: reduce)').matches){gb.addEventListener('pointermove',e=>{if(e.pointerType==='touch')return;const r=gb.getBoundingClientRect();gb.style.setProperty('--x',((e.clientX-r.left)/r.width*100)+'%');gb.style.setProperty('--y',((e.clientY-r.top)/r.height*100)+'%');});}
gb.addEventListener('click',()=>{gb.querySelector('.lb').textContent='Done ✓';setTimeout(()=>gb.querySelector('.lb').textContent='Continue',1200);});One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Liquid Glass Button — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
.bg{position:relative;width:min(300px,100%);height:150px;border-radius:14px;overflow:hidden;background:#f3efe9;display:grid;place-items:center}
.bg i{position:absolute;border-radius:50%;filter:blur(2px)}
.b1{width:110px;height:110px;left:14px;top:-10px;background:#8f9cf5}.b2{width:90px;height:90px;right:18px;top:46px;background:#f58f8f}.b3{width:80px;height:80px;left:100px;bottom:-24px;background:#8fe0c0}
.gb{--x:50%;--y:50%;position:relative;z-index:1;height:48px;min-width:132px;padding:0 26px;border-radius:99px;border:1px solid rgba(255,255,255,.7);background:rgba(255,255,255,.28);backdrop-filter:blur(14px) saturate(1.4);-webkit-backdrop-filter:blur(14px) saturate(1.4);box-shadow:inset 0 1px 0 rgba(255,255,255,.8),0 8px 24px rgba(0,0,0,.12);font:inherit;font-size:14px;font-weight:600;color:#171717;cursor:pointer;overflow:hidden;transition:transform .14s cubic-bezier(.3,1.4,.5,1),background .15s}
.hl{position:absolute;inset:0;background:radial-gradient(circle at var(--x) var(--y),rgba(255,255,255,.55),transparent 55%);opacity:0;transition:opacity .2s}
.gb:hover .hl{opacity:1}
.lb{position:relative}
.gb:active{transform:scale(.96);background:rgba(255,255,255,.18)}
.gb:focus-visible{outline:2px solid #171717;outline-offset:3px}
@supports not (backdrop-filter:blur(1px)){.gb{background:#fff}}
@media (prefers-reduced-motion:reduce){.gb{transition:background .15s}.gb:active{transform:none}.hl{display:none}}
</style></head>
<body><div class="stage">
<div class="bg"><i class="b1"></i><i class="b2"></i><i class="b3"></i><button class="gb" id="gb"><span class="hl"></span><span class="lb">Continue</span></button></div>
</div>
<script>
const gb=document.getElementById('gb');
if(!matchMedia('(prefers-reduced-motion: reduce)').matches){gb.addEventListener('pointermove',e=>{if(e.pointerType==='touch')return;const r=gb.getBoundingClientRect();gb.style.setProperty('--x',((e.clientX-r.left)/r.width*100)+'%');gb.style.setProperty('--y',((e.clientY-r.top)/r.height*100)+'%');});}
gb.addEventListener('click',()=>{gb.querySelector('.lb').textContent='Done ✓';setTimeout(()=>gb.querySelector('.lb').textContent='Continue',1200);});
</script>
</body></html>