How to get firefox to show an auto horizontal scol

2019-02-19 21:07发布

问题:

See this pastie in firefox. When resizing the browser window horizontally, then when the yellow area gets hidden a bit I want a horizontal scrollbar to appear. In Safari this code works fine. How would you style this for firefox?

I am using overflow:auto; I only want the scrollbar to appear when it makes sense, I don't want to see it all the time

回答1:

Firefox doesn't recognize overflow-x and overflow-y.

Instead use overflow:-moz-scrollbars-horizontal; or overflow:-moz-scrollbars-vertical;

This is a Mozilla Firefox specific hack so none of the other browsers should be affected.



回答2:

The best to use would be overflow: auto; this will add a scroll bar only when needed.



回答3:

Specify some width and then "overflow: scroll;"