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-machine添加一個已有的docker主機問題2. html - 用ajax提交表單后,返回驗證數據在頁面location.href跳轉到主頁,怎么傳遞session給主頁3. java-ee - JAVA的注解@Api和@ApiOperation的作用是什么,怎么跳轉頁面的4. apache - nginx 日志刪除后 重新建一個文件 就打不了日志了5. java - mybatis會自己緩存自己生成過的prestatement嗎6. angular.js - grunt server 報錯7. java - tomcat服務經常晚上會掛,求解?8. java - 原生CGLib內部方法互相調用時可以代理,但基于CGLib的Spring AOP卻代理失效,為什么?9. node.js - node express 中ajax post請求參數接收不到?10. mysql的主從復制、讀寫分離,關于從的問題
