can't hide scrollbar when using overflow: auto

Viewed 46875

I have this CSS:

.div {
    background-color: red;
    position: relative;
    height: 414px;
    overflow: auto;
    width: 902px;
    margin: 0px auto;
}

I tried with overflow-y: hidden;, scrollbar disappear but scroll isn't working. Hope you understand what I want... Also, should I use auto or scroll? With auto I see horizontal bar too.

Here is JSFiddle: http://jsfiddle.net/sp95S/
Thanks!

4 Answers

If you want to hide the scrollbar, but keep the functionality, you can use:

/* Hide scrollbar for Chrome, Safari and Opera */
.example::-webkit-scrollbar {
  display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.example {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}
Related