css怎样实现隐蔽滚动条
发布时间:09/01 来源:未知 浏览:
关键词:
挪移端
挪移端页面只有兼容 Chrome 和 Safari 就够了,所以可以运用自定义滚动条的伪类选中器 ::-webkit-scrollbar 来隐蔽滚动条。
.container::-webkit-scrollbar { display: none; }
(举荐教程:CSS教程)
PC 端
PC 端对兼容性的请求相对来说要高一点,所有可以换一种办法,大致思绪就是在内容div外面包一个父容器div,设定 overflow: hidden,内容div设定 display-x: hidden; display-y: auto; 最后设定父容器div的宽度小于内容div的宽度或者设定内容div的 margin-right 为负值就可以了。
1111
222
333
444
.outer { width: 300px; height: 300px; overflow: hidden; .content { width: 330px; /*margin-right: -15px;*/ height: 100%; overflow-x: hidden; overflow-y: auto; background: red; padding-top: 100px; p:not(:first-child) { margin-top: 100px; } } }
相干视频教程举荐:css视频教程
以上就是css怎样实现隐蔽滚动条的细致内容,更多请关注 百分百源码网 其它相干文章!