Home > Article > Web Front-end > How Can I Force Scrollbars to Appear on Mobile Browsers?
Displaying Scrollbars in Mobile Browsers
This question focuses on the issue of hidden scrollbars in mobile browsers when using "overflow:auto" or "overflow:visible" on scrollable content. While the scrollbar is visible on desktop browsers, it disappears on mobile devices unless actively scrolling.
To resolve this issue, you can modify your CSS to include the following code, which is specific to the Webkit browser engine:
::-webkit-scrollbar { -webkit-appearance: none; } ::-webkit-scrollbar:vertical { width: 12px; } ::-webkit-scrollbar:horizontal { height: 12px; } ::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, .5); border-radius: 10px; border: 2px solid #ffffff; } ::-webkit-scrollbar-track { border-radius: 10px; background-color: #ffffff; }
This code defines the appearance of the scrollbar, including its width, height, thumb color, and track color. By customizing these properties, you can make the scrollbar always visible on mobile devices, even before scrolling.
The above is the detailed content of How Can I Force Scrollbars to Appear on Mobile Browsers?. For more information, please follow other related articles on the PHP Chinese website!