Composition Grids
Drag a subject around the frame and switch grids (thirds, golden ratio, centre, diagonals) to see where it sits best.
AI prompt
A lone cyclist on a coastal road, composed by the rule of thirds: the cyclist placed on the lower-left power point, looking toward the open right side of the frame, horizon on the upper third line, large calm sky filling the upper right, soft morning light, 3:2 landscape, wide lens, photographic realism. Composition variants: golden ratio (subject at 38 percent from the left, horizon at 62 percent), centred symmetrical (subject exactly in the middle, vanishing point behind), diagonal (road running corner to corner). Negative: subject cut by the frame edge, tilted horizon, cluttered foreground, text.About this pattern
Definition
Composition grids are guides for placing a subject in a frame: the rule of thirds splits it into nine parts, the golden ratio uses 38/62 divisions, centre composition uses symmetry and diagonals lead the eye across the frame.
When to use it
- Placing the subject on a grid intersection ("power point") usually feels balanced and natural.
- Centre and symmetry feel calm, formal and iconic; diagonals feel dynamic.
- Name the composition in prompts, plus where the subject sits and where the empty space is.
What the controls do
- Five buttons choose a grid; drag the subject; the note says when it sits on a power point.
Motion & timing
- The subject follows your pointer with no easing; grid lines fade in over 200ms.
- Reduced motion: lines appear instantly.
Tips & variations
- Grids follow the frame at any aspect ratio; keep space ahead of a moving or looking subject.
- For crops, keep the subject on a power point in each ratio.
Code of this live preview
<div class="bx"><div class="fr" id="fr"><div class="sky"></div><div class="sea"></div><svg class="grid" id="grid" viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true"></svg><i class="sub" id="sub" role="img" aria-label="Subject, drag to move" tabindex="0"></i></div>
<div class="pre" id="pre" role="group" aria-label="Grid"><button data-g="thirds" aria-pressed="true">Thirds</button><button data-g="golden" aria-pressed="false">Golden</button><button data-g="center" aria-pressed="false">Centre</button><button data-g="diag" aria-pressed="false">Diagonal</button><button data-g="none" aria-pressed="false">Off</button></div><p class="out" id="out" aria-live="polite"></p></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}
.bx{width:min(300px,100%);display:grid;gap:8px}
.fr{position:relative;height:150px;border-radius:12px;overflow:hidden;background:#cfd8e3;touch-action:none}
.sky{position:absolute;left:0;right:0;top:0;height:34%;background:linear-gradient(#a9c2d8,#e6ecee)}
.sea{position:absolute;left:0;right:0;top:34%;bottom:0;background:linear-gradient(#7f9fb2,#4a6a7f)}
.grid{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;animation:gi .2s ease-out}
@keyframes gi{from{opacity:0}}
.grid line{stroke:rgba(255,255,255,.9);stroke-width:.6;vector-effect:non-scaling-stroke}
.grid circle{fill:rgba(255,255,255,.5);stroke:#fff}
.sub{position:absolute;left:var(--x,33%);top:var(--y,66%);width:22px;height:22px;margin:-11px 0 0 -11px;border-radius:50%;background:#b4583a;border:2px solid #fff;cursor:grab;box-shadow:0 2px 6px rgba(0,0,0,.3)}
.sub:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.pre{display:grid;grid-template-columns:repeat(5,1fr);gap:4px}
.pre button{height:28px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font:inherit;font-size:11px;cursor:pointer;padding:0}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.out{font-size:12px;color:var(--muted);min-height:16px}.out b{color:var(--text)}
@media (prefers-reduced-motion:reduce){.grid{animation:none}}const fr=document.getElementById('fr'),grid=document.getElementById('grid'),sub=document.getElementById('sub'),out=document.getElementById('out'),bs=[...document.querySelectorAll('#pre button')];let g='thirds',px=33.3,py=66.6;
const L=(a,b,c,d)=>'<line x1="'+a+'" y1="'+b+'" x2="'+c+'" y2="'+d+'"/>';
const G={thirds:{l:L(33.33,0,33.33,100)+L(66.67,0,66.67,100)+L(0,33.33,100,33.33)+L(0,66.67,100,66.67),p:[[33.33,33.33],[66.67,33.33],[33.33,66.67],[66.67,66.67]]},
golden:{l:L(38.2,0,38.2,100)+L(61.8,0,61.8,100)+L(0,38.2,100,38.2)+L(0,61.8,100,61.8),p:[[38.2,38.2],[61.8,38.2],[38.2,61.8],[61.8,61.8]]},
center:{l:L(50,0,50,100)+L(0,50,100,50),p:[[50,50]]},
diag:{l:L(0,0,100,100)+L(100,0,0,100),p:[[50,50]]},none:{l:'',p:[]}};
function draw(){const d=G[g];grid.innerHTML=d.l+d.p.map(p=>'<circle cx="'+p[0]+'" cy="'+p[1]+'" r="1.6"/>').join('');grid.style.animation='none';void grid.offsetWidth;grid.style.animation='';
bs.forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.g===g)));note();}
function note(){const d=G[g].p.find(p=>Math.hypot(p[0]-px,p[1]-py)<7);out.innerHTML=g==='none'?'Grid off.':d?'<b>On a power point</b>: this placement feels balanced.':'Move the subject to a marked intersection.';}
function place(x,y){px=Math.max(4,Math.min(96,x));py=Math.max(6,Math.min(94,y));sub.style.setProperty('--x',px+'%');sub.style.setProperty('--y',py+'%');note();}
let drag=false;const mv=e=>{const r=fr.getBoundingClientRect();place((e.clientX-r.left)/r.width*100,(e.clientY-r.top)/r.height*100);};
fr.addEventListener('pointerdown',e=>{drag=true;fr.setPointerCapture(e.pointerId);mv(e);});fr.addEventListener('pointermove',e=>{if(drag)mv(e);});fr.addEventListener('pointerup',()=>drag=false);fr.addEventListener('pointercancel',()=>drag=false);
sub.addEventListener('keydown',e=>{const k={ArrowLeft:[-3,0],ArrowRight:[3,0],ArrowUp:[0,-3],ArrowDown:[0,3]}[e.key];if(k){e.preventDefault();place(px+k[0],py+k[1]);}});
bs.forEach(b=>b.addEventListener('click',()=>{g=b.dataset.g;draw();}));place(px,py);draw();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>Composition Grids — 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}}
.bx{width:min(300px,100%);display:grid;gap:8px}
.fr{position:relative;height:150px;border-radius:12px;overflow:hidden;background:#cfd8e3;touch-action:none}
.sky{position:absolute;left:0;right:0;top:0;height:34%;background:linear-gradient(#a9c2d8,#e6ecee)}
.sea{position:absolute;left:0;right:0;top:34%;bottom:0;background:linear-gradient(#7f9fb2,#4a6a7f)}
.grid{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;animation:gi .2s ease-out}
@keyframes gi{from{opacity:0}}
.grid line{stroke:rgba(255,255,255,.9);stroke-width:.6;vector-effect:non-scaling-stroke}
.grid circle{fill:rgba(255,255,255,.5);stroke:#fff}
.sub{position:absolute;left:var(--x,33%);top:var(--y,66%);width:22px;height:22px;margin:-11px 0 0 -11px;border-radius:50%;background:#b4583a;border:2px solid #fff;cursor:grab;box-shadow:0 2px 6px rgba(0,0,0,.3)}
.sub:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.pre{display:grid;grid-template-columns:repeat(5,1fr);gap:4px}
.pre button{height:28px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font:inherit;font-size:11px;cursor:pointer;padding:0}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.out{font-size:12px;color:var(--muted);min-height:16px}.out b{color:var(--text)}
@media (prefers-reduced-motion:reduce){.grid{animation:none}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="fr" id="fr"><div class="sky"></div><div class="sea"></div><svg class="grid" id="grid" viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true"></svg><i class="sub" id="sub" role="img" aria-label="Subject, drag to move" tabindex="0"></i></div>
<div class="pre" id="pre" role="group" aria-label="Grid"><button data-g="thirds" aria-pressed="true">Thirds</button><button data-g="golden" aria-pressed="false">Golden</button><button data-g="center" aria-pressed="false">Centre</button><button data-g="diag" aria-pressed="false">Diagonal</button><button data-g="none" aria-pressed="false">Off</button></div><p class="out" id="out" aria-live="polite"></p></div>
</div>
<script>
const fr=document.getElementById('fr'),grid=document.getElementById('grid'),sub=document.getElementById('sub'),out=document.getElementById('out'),bs=[...document.querySelectorAll('#pre button')];let g='thirds',px=33.3,py=66.6;
const L=(a,b,c,d)=>'<line x1="'+a+'" y1="'+b+'" x2="'+c+'" y2="'+d+'"/>';
const G={thirds:{l:L(33.33,0,33.33,100)+L(66.67,0,66.67,100)+L(0,33.33,100,33.33)+L(0,66.67,100,66.67),p:[[33.33,33.33],[66.67,33.33],[33.33,66.67],[66.67,66.67]]},
golden:{l:L(38.2,0,38.2,100)+L(61.8,0,61.8,100)+L(0,38.2,100,38.2)+L(0,61.8,100,61.8),p:[[38.2,38.2],[61.8,38.2],[38.2,61.8],[61.8,61.8]]},
center:{l:L(50,0,50,100)+L(0,50,100,50),p:[[50,50]]},
diag:{l:L(0,0,100,100)+L(100,0,0,100),p:[[50,50]]},none:{l:'',p:[]}};
function draw(){const d=G[g];grid.innerHTML=d.l+d.p.map(p=>'<circle cx="'+p[0]+'" cy="'+p[1]+'" r="1.6"/>').join('');grid.style.animation='none';void grid.offsetWidth;grid.style.animation='';
bs.forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.g===g)));note();}
function note(){const d=G[g].p.find(p=>Math.hypot(p[0]-px,p[1]-py)<7);out.innerHTML=g==='none'?'Grid off.':d?'<b>On a power point</b>: this placement feels balanced.':'Move the subject to a marked intersection.';}
function place(x,y){px=Math.max(4,Math.min(96,x));py=Math.max(6,Math.min(94,y));sub.style.setProperty('--x',px+'%');sub.style.setProperty('--y',py+'%');note();}
let drag=false;const mv=e=>{const r=fr.getBoundingClientRect();place((e.clientX-r.left)/r.width*100,(e.clientY-r.top)/r.height*100);};
fr.addEventListener('pointerdown',e=>{drag=true;fr.setPointerCapture(e.pointerId);mv(e);});fr.addEventListener('pointermove',e=>{if(drag)mv(e);});fr.addEventListener('pointerup',()=>drag=false);fr.addEventListener('pointercancel',()=>drag=false);
sub.addEventListener('keydown',e=>{const k={ArrowLeft:[-3,0],ArrowRight:[3,0],ArrowUp:[0,-3],ArrowDown:[0,3]}[e.key];if(k){e.preventDefault();place(px+k[0],py+k[1]);}});
bs.forEach(b=>b.addEventListener('click',()=>{g=b.dataset.g;draw();}));place(px,py);draw();
</script>
</body></html>