Skip to content

Latest commit

 

History

History
73 lines (66 loc) · 2 KB

scrollbar.md

File metadata and controls

73 lines (66 loc) · 2 KB

Custom scrollbar

?> Background::point_right: box-shadow, ::-webkit-scrollbar

<script v-pre type="text/x-template" id="scrollbar"> <style> main{ width: 100%; padding: 39px 0; display: flex; align-items: center; justify-content: center; } .scrollbar-main { width:60%; height: 299px; overflow: auto; } .scrollbar-main .row { display: inline-block; padding: 12px; background: rgba(180,160,120,.1); text-align: center; white-space: nowrap; } .scrollbar-main::-webkit-scrollbar { width: 8px; background: white; } .scrollbar-main::-webkit-scrollbar-corner, /* Scroll bar corner */ .scrollbar-main::-webkit-scrollbar-thumb, .scrollbar-main::-webkit-scrollbar-track { border-radius: 5px; } .scrollbar-main::-webkit-scrollbar-corner, .scrollbar-main::-webkit-scrollbar-track { /* Scroll bar track */ background-color: rgba(180,160,120,.1); box-shadow: inset 0 0 1px rgba(180,160,120,.5); } .scrollbar-main::-webkit-scrollbar-thumb { /* Scroll bar handle */ background-color: rgb(180,160,120); } </style>
{{ row }}
<script> export default { computed: { rows () { return Array.from({ length: 56 }).map((v, i) => Array(99).fill(i + 11).join(' ')); } } } </script> </script>

!> Poor compatibility, many styles are uncontrollable, it is recommended to use similar solution like perfect-scrollbar in production environment

Browser Support

<iframe width="100%" height="436px" frameborder="0" src="https://caniuse.bitsofco.de/embed/index.html?feat=css-scrollbar&periods=future_1,current,past_1,past_2,past_3&accessible-colours=false"> </iframe>