Home > database >  no scrollbar for empty big width div on firefox
no scrollbar for empty big width div on firefox

Time:06-01

using this code on chrome browsers will give me a div with a horizontal scrollbar

<div style="overflow-y: scroll;background:black;width:300px;height:100px;">
  <div style="min-width: 1000px;"></div>
</div>

but not on firefox, on ff it will only have a scrollbar if the internal div has some content,

I'm wondering if this is a known issue, and if there's any workaround for it, thank you.

CodePudding user response:

If you give the inner div some height it will work in Firefox. I've added a border on the right so you can see it is actually scrolling. You're right though that does appear to be a browser quirk.

Note that overflow-y is for vertical scrolling (y axis) and overflow-x is for horizontal scrolling (x axis).

<div style="overflow-x: scroll;background:black;width:300px;height:100px;">
  <div style="min-width: 1000px;border-right:20px solid red;height:100%;"></div>
</div>

  • Related