Css overflow-x: automatically show only when width is less than a certain amount

my <html style="overflow-x:hidden; overflow-y:hidden

inside there is a div with overflow-x: auto; Overflow-y: scroll; min-width: 960px; but when my browser view is larger than 960 pixels, it still shows a horizontal scrollbar. How to make a horizontal bar only if necessary, if the width is less than 960?

+4
source share
1 answer

All you have to do is

 <html style="overflow-x:auto; overflow-y:auto> 

but it is prettier when overflow-y set to scroll ;

Besides

 overflow-x:auto; overflow-y:scroll; 

should be applied to the html tag or to :root . Only in this case they will work.

+4
source

All Articles