Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to change horizontal scrollbar css

Tags:

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; 
}

enter image description here

like image 691
user8989878 Avatar asked Mar 05 '19 05:03

user8989878


People also ask

How do I change the horizontal scroll bar in CSS?

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.

Can we customize scrollbar in CSS?

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.

How do I change scroll bar settings?

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.

How do I change my scroll bar from vertical to horizontal?

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.


1 Answers

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>
like image 54
farhan siddiqui Avatar answered Dec 10 '22 01:12

farhan siddiqui