Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding scrollbars via css doesn't work in Safari, how to fix it?

Tags:

css

safari

I'm trying to hide scrollbars of an html element by means of the CSS rule:

.element::-webkit-scrollbar {width: 0;}

It works fine in Chrome, but doesn't work in Safari, although is't also webkit-based and should support this rule.

Any ideas, why should it happen and how to fix?

like image 328
gregory Avatar asked Dec 02 '25 00:12

gregory


1 Answers

For Cross Browser, use following -

.hide-scrollbar {
  /*FireFox*/
  scrollbar-width: none;
  /*IE10+*/
  -ms-overflow-style: -ms-autohiding-scrollbar;
}
.hide-scrollbar::-webkit-scrollbar {
  /*Chrome, Safari, Edge*/
  display: none;
}
like image 112
Daniel Smith Avatar answered Dec 04 '25 14:12

Daniel Smith