簡體   English   中英

如何使 webkit-scrollbar 僅在一個 div 上可見?

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

我有一些溢出的水平內容,並且希望滾動條始終可見以支持 Windows 設備,但我不希望在其他任何地方滾動條。 `

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

我有這個 CSS/sass,我認為它應該可以工作,因為 class 具有更高的特異性,但是我仍然沒有在.polls-row 上獲得滾動條

我怎樣才能做到這一點?

使用以下 css 更新您的代碼

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM