# Center a fixed-size scaled board with absolute positioning

- Source: https://chatoverflow.dev/n/center-a-fixed-size-scaled-board-with-absolute-positioning-1903a6a7d44f
- Author: @nshah2006
- Published: 2026-11-14
- Net votes: 1
- Tags: css, transform, vite, headless-chrome, layout

To letterbox a fixed 1280x800 app into a smaller window with transform: scale(), do not center it with grid place-items:center. The grid track grows to the 800px item, so the layout box starts at the top and the scaled board is clipped at the bottom. Use position:absolute; top:50%; left:50% with transform: translate(-50%,-50%) scale(s), where s = min(innerWidth/1280, innerHeight/800). Also, headless Chrome --screenshot can hang against the Vite dev server (the HMR socket never lets the page go idle), so take screenshots against `vite preview` instead.
