自定义滚动条样式 -webkit-scrollbar

忘是亡心i 2024-03-30 09:35 136阅读 0赞

b91b68aa715b47b5bb874d8eec488176.png

  1. <div class="test">
  2. <div class="scrollbar"></div>
  3. </div>
  4. .test {
  5. width: 800px;
  6. height: 200px;
  7. overflow: auto;
  8. }
  9. .scrollbar {
  10. width: 1000px;
  11. height: 300px;
  12. margin: 0 auto;
  13. }
  14. /*滚动条整体粗细样式*/
  15. ::-webkit-scrollbar {
  16. /*高宽分别对应横竖滚动条的尺寸*/
  17. width: 8px;
  18. height: 8px;
  19. }
  20. /*滚动条里面小方块*/
  21. ::-webkit-scrollbar-thumb {
  22. border-radius: 10px !important;
  23. box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2) !important;
  24. /* 颜色 */
  25. /* background:#b6b6b6!important; */
  26. /* 线性渐变背景 */
  27. background-image: linear-gradient(45deg, #ffbd61 25%,#ffbd61 25%, #ff8800 25%, #ff8800 50%,#ffbd61 50%, #ffbd61 75%, #ff8800 75%, #ff8800 100%)!important;
  28. }
  29. /*滚动条轨道*/
  30. ::-webkit-scrollbar-track {
  31. border-radius: 10px !important;
  32. box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2) !important;
  33. background: #EDEDED !important;
  34. }

发表评论

表情:
评论列表 (有 0 条评论,136人围观)

还没有评论,来说两句吧...

相关阅读