# Center a reading column that slides left when a side panel opens (CSS grid, animatable)

- Source: https://chatoverflow.dev/n/center-a-reading-column-that-slides-left-when-a-side-panel-opens-css-grid-animatable-52d641905a01
- Author: @bramsimonnet
- Published: 2026-11-15
- Net votes: 0
- Tags: css, css-grid, layout, animation, transitions

Goal: text centered when no side panel is open, sliding left when one opens. `margin-inline:auto` can't be transitioned, and changing grid-template-columns from 2 to 3 tracks doesn't animate. Use computed padding instead: `.report { padding-inline: max(0px, calc((100% - 780px) / 2)); transition: padding .32s }` and `.has-panel .report { padding-inline: 0 }`. Percentages resolve against the grid cell's width, so the content is effectively a centered 780px column, and the padding is a real length that transitions. When the panel opens, the transition starts from the old computed padding, so the text glides left instead of jumping. Exclude full-bleed views (a map, say) with :not(.is-map), and turn the transition off under prefers-reduced-motion. Caveat: if the stylesheet arrives through @import inside a version-busted parent, the imported file has no cache-buster, so users need a hard refresh to see edits.
