Flat Design Depth Levels
The same icon as flat, long-shadow, soft-shadow and layered, with a depth slider.
AI prompt
Set of flat vector icons of a rounded square badge with a white circle inside on a pale background, shown in four treatments: pure flat, a long 45 degree shadow in a darker tone, a soft blurred drop shadow, and three stacked offset layers. Same coral colour in all four, consistent light direction from the top left, clean geometric shapes, no outlines, no textures. Negative: mixed light directions, gradients inside the shape, text, noisy backgrounds. Reduced motion: static set.About this pattern
Definition
Flat illustration can still carry depth. Long shadows run diagonally behind a shape, soft shadows float it above the page, and layers offset copies of it. Each trades simplicity for dimension in a different way.
When to use it
- Flat: no shadow at all; relies on colour and shape.
- Long shadow: a diagonal band at 45 degrees, fading out, gives a retro feel.
- Soft shadow: a blurred, offset shadow suggests a floating card.
- Layered: stacked offset copies suggest a pile.
What the controls do
- Four style buttons and a Depth slider.
Motion & timing
- Shadows change instantly.
- Reduced motion: nothing animates.
Tips & variations
- Pick one depth treatment per illustration set.
- Long shadows must all go in the same direction.
Code of this live preview
<div class="bx"><div class="sc"><div class="ic" id="ic"><i></i></div></div><div class="pre" id="pre" role="group" aria-label="Style"><button data-p="0" aria-pressed="true">Flat</button><button data-p="1" aria-pressed="false">Long shadow</button><button data-p="2" aria-pressed="false">Soft</button><button data-p="3" aria-pressed="false">Layered</button></div><label class="rw">Depth <b id="dv">40</b><input id="dp" type="range" min="10" max="100" value="40"></label></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}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sc{height:140px;border-radius:12px;background:#f1efe9;display:grid;place-items:center;overflow:hidden}
.ic{width:70px;height:70px;border-radius:18px;background:#ff6f61;display:grid;place-items:center;position:relative}.ic i{width:28px;height:28px;border-radius:50%;background:#fff}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const ic=document.getElementById('ic'),dp=document.getElementById('dp'),bs=[...document.querySelectorAll('#pre button')];let p=0;
function up(){const d=+dp.value;let s='none';
if(p===1){const a=[];for(let i=1;i<=d;i++)a.push(i+'px '+i+'px 0 rgb(214,84,72,'+(1-i/d*.85).toFixed(2)+')');s=a.join(',');}
if(p===2)s='0 '+(d*.3)+'px '+(d*.6)+'px rgba(80,30,25,.35)';
if(p===3){const k=d/10;s=k+'px '+k+'px 0 #ff9a8f,'+k*2+'px '+k*2+'px 0 #ffc2bb,'+k*3+'px '+k*3+'px 0 #ffe0dc';}
ic.style.boxShadow=s;document.getElementById('dv').textContent=d;bs.forEach(b=>b.setAttribute('aria-pressed',String(+b.dataset.p===p)));}
bs.forEach(b=>b.addEventListener('click',()=>{p=+b.dataset.p;up();}));dp.addEventListener('input',up);up();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>Flat Design Depth Levels — 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}}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sc{height:140px;border-radius:12px;background:#f1efe9;display:grid;place-items:center;overflow:hidden}
.ic{width:70px;height:70px;border-radius:18px;background:#ff6f61;display:grid;place-items:center;position:relative}.ic i{width:28px;height:28px;border-radius:50%;background:#fff}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="sc"><div class="ic" id="ic"><i></i></div></div><div class="pre" id="pre" role="group" aria-label="Style"><button data-p="0" aria-pressed="true">Flat</button><button data-p="1" aria-pressed="false">Long shadow</button><button data-p="2" aria-pressed="false">Soft</button><button data-p="3" aria-pressed="false">Layered</button></div><label class="rw">Depth <b id="dv">40</b><input id="dp" type="range" min="10" max="100" value="40"></label></div>
</div>
<script>
const ic=document.getElementById('ic'),dp=document.getElementById('dp'),bs=[...document.querySelectorAll('#pre button')];let p=0;
function up(){const d=+dp.value;let s='none';
if(p===1){const a=[];for(let i=1;i<=d;i++)a.push(i+'px '+i+'px 0 rgb(214,84,72,'+(1-i/d*.85).toFixed(2)+')');s=a.join(',');}
if(p===2)s='0 '+(d*.3)+'px '+(d*.6)+'px rgba(80,30,25,.35)';
if(p===3){const k=d/10;s=k+'px '+k+'px 0 #ff9a8f,'+k*2+'px '+k*2+'px 0 #ffc2bb,'+k*3+'px '+k*3+'px 0 #ffe0dc';}
ic.style.boxShadow=s;document.getElementById('dv').textContent=d;bs.forEach(b=>b.setAttribute('aria-pressed',String(+b.dataset.p===p)));}
bs.forEach(b=>b.addEventListener('click',()=>{p=+b.dataset.p;up();}));dp.addEventListener('input',up);up();
</script>
</body></html>