简体   繁体   中英

How to make webkit-scrollbar only visible on one div?

I have some overflowing horizontal content and want to have a scrollbar visible always to support Windows devices, but I don't want scrollbars anywhere else. `

 ::-webkit-scrollbar {
    display: none;
}
.polls-row::-webkit-scrollbar {
    height: 1rem;
}

.polls-row::-webkit-scrollbar-track {
    box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}

.polls-row::-webkit-scrollbar-thumb {
  background-color: $color-border;
  border-radius: $radius;
  outline: 1px solid slategrey;
}

I have this CSS/sass, which I think should work because the class has higher specificity, however I still don't get a scrollbar on.polls-row

How can I do this?

Update your code with below css

::-webkit-scrollbar {
    overflow:hidden;
}

Right Way ->  ::-webkit-scrollbar{ overflow:hidden; }
Wrong Way ->  ::-webkit-scrollbar{ display:none; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM