.scroll {
position: absolute;
left: 0;
top: 0;
background: yellow;
overflow: auto;
max-height: 100px;
}
<div class="scroll">
<div>123456789</div>
<div>123456789</div>
<div>123456789</div>
<div>123456789</div>
<div>123456789</div>
<div>123456789</div>
<div>123456789</div>
</div>
Firefox 79
When the height of the div overflows, Firefox displays a vertical scrollbar without increasing the width of the div to accommodate it, causing a horizontal scrollbar to show.
Chrome 84
Chrome increases the width of the div as expected and no horizontal scrollbar is shown.
How can I make Firefox work like Chrome?
Constraints:
- The width of the
scrolldiv needs to match its content. - Overflow needs to be auto.
What I've tried:
min-width: 0/auto- Flexbox (to get the auto width)
- Various combinations of extra wrapper divs


position: absolutestyle in dev tools it "fixes" itself, which tells me that it's probably a browser bug. But I wasn't experiencing that before. - Decade Moon