下午有時間就整理一下以前寫過的一些東西,覺得這個css改變滾動條樣式比較常用就順手記錄了下來
<style type="text/css">
::-webkit-scrollbar {/*滾動條整體樣式*/
width: 14px;
height: 14px;
}
::-webkit-scrollbar-track{/*滾動條裏面小方塊*/
border-radius: 999px;
border: 5px solid transparent;
inset 1px 1px 5px rgba(0,0,0,0.2);
background: rgba(0,0,0,0.1);
}
::-webkit-scrollbar-thumb {/*滾動條裏面軌道*/
min-height: 20px;
border-radius: 999px;
border: 5px solid transparent;
background: #aaa;
background-clip: content-box;
box-shadow: 0 0 0 5px rgba(0, 0, 0, .2) inset;
}
::-webkit-scrollbar-corner {
background: transparent;
}
</style>
把上面這段代碼放到head裏面就可以了(但是好像有一部分瀏覽器不支持,谷歌是肯定可以的,哈哈)