css3 - 关于滚动条的CSS如何设置问题
问题描述
<p id=’p3’ style=’width:200px;height:200px;overflow:auto;’>This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text.This is some text. This is some text. This is some text. This is some text. </p>
就像上面代码 p里面有一段文字,我设置了overflow:auto;也就是超出部分显示滚动条,那么我如何修改这个滚动条的样式呢?
问题解答
回答1:一个针对Webkit内核浏览器的滚动条美化的例子,不知道是不是你想要的
/* 滚动条部分 */::-webkit-scrollbar { width:15px;}/* 轨道 */::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-border-radius: 15px; border-radius: 15px;}/* 手柄 */::-webkit-scrollbar-thumb { -webkit-border-radius: 15px; border-radius: 15px; background:rgba(200,200,200,0.7); -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); }/* 手柄激活态 */::-webkit-scrollbar-thumb:window-inactive { background: rgba(200,200,200,0.4); }回答2:
那就定义浏览器滚动条样式即可,两者是一致的,如果需要不一样,那就需要模拟滚动条
回答3:推荐你参考这篇文章:http://www.qianduan.net/css-custom-scroll-bar-style/作者是微信团队的神飞,写的文章一直很不错!
回答4:话说滚动更改滚动条样式。为什么pc端可以正常显示。手机端就不行了呢
相关文章:
1. docker镜像push报错2. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?3. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?4. docker api 开发的端口怎么获取?5. 如何解决docker宿主机无法访问容器中的服务?6. macos - mac下docker如何设置代理7. 老师,flex-shrink: 1; 按视频操作,不会自动缩放8. python - 怎样在linux下开发flask web应用时查看代码出错(traceback)的地方。9. 前端 - 类到底该如何去命名 .newsList 这种的命名难道真的不是过度语义化吗?~10. PHP中的$this代表当前的类还是方法?

网公网安备