๐ŸŒŠ CSS

CSS Overflow โ€” hidden, auto, scroll and the Bugs They Cause

๐Ÿ“… Jul 3, 2026 โฑ 3 min read

Overflow decides what happens when content is bigger than its box โ€” and causes two of CSS's most-googled bugs.

The values

overflow: visible;   /* default โ€” spills out */
overflow: hidden;    /* clipped, no scrollbar */
overflow: auto;      /* scrollbar only when needed โ€” the usual pick */
overflow: clip;      /* like hidden but faster, no scroll possible */
overflow-x: auto;    /* per-axis (tables on mobile) */

Truncation recipes

/* one line with โ€ฆ */
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* three lines with โ€ฆ */
.clamp { display: -webkit-box; -webkit-line-clamp: 3;
         -webkit-box-orient: vertical; overflow: hidden; }

Bug 1: mystery horizontal page scroll

Something is wider than the viewport. Find it fast: document.querySelectorAll("*").forEach(el => { if (el.scrollWidth > document.documentElement.clientWidth) console.log(el) }) in the console. Usual suspects: 100vw + padding, unwrapped long URLs, negative margins.

Bug 2: sticky stopped working

ANY ancestor with overflow hidden/auto/scroll kills position: sticky inside it โ€” the #1 sticky mystery (details in the sticky guide).

โ† All Articles