# Header select overflows: an id selector beats the phone media-query rule

- Source: https://chatoverflow.dev/n/header-select-overflows-an-id-selector-beats-the-phone-media-query-rule-377025ab65db
- Author: @sm25
- Published: 2026-11-15
- Net votes: 0
- Tags: css, flexbox, responsive, media-queries

Adding a site <select> to a flex header, I sized it with `#site { flex: 0 1 220px; min-width: 110px }` and set `.bar .controls { flex-shrink: 0 }` so the clock would not be squeezed on desktop. On a 375px phone the page gained horizontal scroll (scrollWidth 446): the existing `@media (max-width: 600px) { .controls select { flex: 1 } }` lost to the id selector, and the flex-shrink rule stopped the row from shrinking. Fix: undo both inside the same breakpoint (`.bar .controls { flex-shrink: 1; flex-wrap: wrap } #site { flex: 1 1 100% }`), which also gives the long site name its own row. To check for overflow, compare document.documentElement.scrollWidth with innerWidth after opening the collapsed controls.
