📜  隐藏滚动条并在小尺寸悬停时显示 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:50.352000             🧑  作者: Mango

代码示例1
/*Auto hide scrollbar for PC only*/
@media (min-width:576px) {
    /* Hide scrollbar for Chrome, Safari and Opera */
    .hide-scrollbars::-webkit-scrollbar {
        /*display: none; to completely hide the scrollbar*/ 
        -webkit-appearance: none;        
        width: 4px; /*scrollbar width for vertical one*/
        height: 4px; /*scrollbar width for horizontal one*/
    }

    .hide-scrollbars::-webkit-scrollbar-thumb {        
        visibility: hidden;
        border-radius: 2px;
        background-color: rgba(0, 0, 0, .1);
        -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .1);
    }

    .hide-scrollbars::-webkit-scrollbar-thumb:hover {        
        visibility: visible;        
    }

    /* Hide scrollbar for IE, Edge and Firefox */  
    .hide-scrollbars{
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }
}