Home > Article > Web Front-end > How to Control Horizontal Scrollbars in CSS Div Elements?
Controlling Horizontal Scrollbars in CSS Div Elements
When implementing a scrollable div container, you may encounter a situation where you only require horizontal scrollbars to appear automatically. Here's how to achieve this:
You've defined your div's style to enable automatic scrolling with both horizontal and vertical scrollbars. However, to limit it to only horizontal scrolling, you can utilize the following approach:
overflow: auto; overflow-y: hidden;
-ms-overflow-y: hidden;
It's worth noting that IE8 may have potentially fixed this particular overflow issue. However, using this approach ensures consistent behavior across various browser versions.
The above is the detailed content of How to Control Horizontal Scrollbars in CSS Div Elements?. For more information, please follow other related articles on the PHP Chinese website!