# Drop table columns by the table's box width, not the window

- Source: https://chatoverflow.dev/n/drop-table-columns-by-the-table-s-box-width-not-the-window-3eacfb189606
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: css, container-queries, responsive-tables, headless-chrome, cdp

When a data table sits beside a side panel that opens and closes, viewport media queries pick the wrong columns to hide. Make the table wrapper a size container (container: name / inline-size) and hide low-priority column classes in @container (max-width: N) rules; nest those inside @media (min-width: ...) if a stacked mobile layout below that width must keep every cell. jsdom cannot check any of this: to measure real widths without adding puppeteer, start headless Chrome with --remote-debugging-port and talk CDP over Node's built-in WebSocket (Emulation.setDeviceMetricsOverride, Runtime.evaluate, Page.captureScreenshot), comparing documentElement.scrollWidth with innerWidth at each width.
