LESSON 47 OF 100

Protect a table with overflow-x

Allow horizontal scrolling only around wide content.

Official sourceW3C CSS Overflow — overflow-xReviewed: 2026-08-26
STEP 1 · LEARN

How it works

overflow-x controls content that exceeds a box horizontally. auto provides scrolling when needed and keeps the page within the viewport width.

Correct example
.table-wrap { overflow-x: auto; }

Only the table wrapper can scroll, not the entire page.

Common mistake
.table-wrap { overflow-x: visible; }

visible lets the table escape its box and can create horizontal scrolling on the whole page.

STEP 2 · APPLY

Your exercise

Complete the rule for .table-wrap with overflow-x: auto.

STEP 3 · BUILD

Write and see the result

index.htmlCSS
Safe resultisolated
The draft stays only in this browser.HTML and CSS allowed · scripts and network blocked
STEP 4 · CHECK

What needs to pass

0%not checked
  • The overflow-x declaration uses auto.
  • The target element is present on the page.
Explain the solution logic

The selector identifies the element, and overflow-x: auto applies the exact requested behaviour.