web-layout-best-practices
Web and Storybook layout and sizing guidance. Use when centering or sizing UI elements, reviewing positioning code, or composing Storybook hosts and decorators.
Files1
View on GitHubSKILL.mdskills/web-layout-best-practices/SKILL.md
GitHubWeb Layout Best Practices
- Center with Flexbox, Grid, or
mx-auto; transforms do not participate in layout, so avoidleft-1/2plus-translate-x-1/2. - Use CSS
zoomwhen scaling must affect layout;transform: scale()changes only visual rendering. - Prefer
fullscreenlayout in Storybook; usemx-auto flex min-h-screen w-full max-w-2xl items-center justify-center p-2forw-fullcontainer components, while intrinsic-size icons and buttons need only flex centering without a constrained-width host. - Choose fixed versus adaptive dimensions deliberately; for example, buttons usually use fixed
h-*andpx-*with content-driven width for font size and localization, while fixedw-*or adaptive height are exceptions. - Keep elements in flow when possible; use negative margins for overlap, reserving
absolutefor true overlays.