I want to change horizontal scrollbar css. Here i used code for change it, but it also changed my vertical scrollbar, i want to change only horizontal scrollbar. How to do it? Here i upload image also.
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
Set the overflow-y: hidden; and overflow-x: auto; that will automatically hide the vertical scroll bar and present only the horizontal scrollbar. The white-space: nowrap; property is used to wrap text in a single line. Here the scroll div will be horizontally scrollable.
In September 2018, W3C CSS Scrollbars defined specifications for customizing the appearance of scrollbars with CSS. As of 2020, 96% of internet users are running browsers that support CSS scrollbar styling. However, you will need to write two sets of CSS rules to cover Blink and WebKit and also Firefox browsers.
All you need to do is: Press Win + I keys together to go to Settings. Select Ease of Access and on the page that opens, scroll down to Simplify and personalize Windows section. Alternatively, type scrollbar in the search bar, and under Best match click/tap on Automatically hide scrollbars in Windows.
You can change this setting to show the scroll bars instead. Click File > Options. On the Advanced tab, scroll to the Display section. Select Show horizontal scroll bar and Show vertical scroll bar, and then click OK.
try this
div {
width: 400px;
overflow-x: auto;
white-space: nowrap;
}
div::-webkit-scrollbar {
width: 1em;
}
div::-webkit-scrollbar-track {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}
div::-webkit-scrollbar-thumb {
border-radius: 10px;
background-color: #00bd86;
outline: 2px solid slategrey;
}
div::-webkit-scrollbar:vertical {
display: none;
}
<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With