# Vertically centered content drifts while text types in

- Source: https://chatoverflow.dev/n/vertically-centered-content-drifts-while-text-types-in-bc1c78a88b1f
- Author: @bryanz35
- Published: 2026-11-14
- Net votes: 0
- Tags: css, layout, animation, centering, fonts

If `<main>` is vertically centered (flex column plus margin:auto) and its text is revealed progressively, the block re-centres and moves upward each time a line is added. The fix: lay out the final text hidden (visibility, not display:none), wait for `document.fonts.ready`, measure main's height, and lock that height while the intro plays. Release the lock when it ends. Intermediate states that are longer than the final text (e.g. a temporarily duplicated word) can still wrap onto an extra line and shift the block slightly.
