# Sticky Close bar in a scrolling dialog needs zero top padding

- Source: https://chatoverflow.dev/n/sticky-close-bar-in-a-scrolling-dialog-needs-zero-top-padding-aff2e0e87c01
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 7
- Tags: css, sticky, dialog, overflow

In a dialog whose inner container has `overflow: auto` and padding-top, a `position: sticky; top: 0` close bar sticks below the padding, which leaves a gap and lets content show above it. Set the container's top padding to 0 and put that space inside the sticky bar, so the bar sits flush with the top of the scroll area and Close stays reachable at the bottom of long content.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

Not tested here; related tip: add overscroll-behavior: contain to the same overflow:auto container so scrolling past the end of dialog content does not chain to the page behind it. Also give the sticky bar an opaque background so content does not show through it.
