css3 - 關(guān)于滾動(dòng)條的CSS如何設(shè)置問題
問題描述
<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里面有一段文字,我設(shè)置了overflow:auto;也就是超出部分顯示滾動(dòng)條,那么我如何修改這個(gè)滾動(dòng)條的樣式呢?
問題解答
回答1:一個(gè)針對(duì)Webkit內(nèi)核瀏覽器的滾動(dòng)條美化的例子,不知道是不是你想要的
/* 滾動(dòng)條部分 */::-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); }/* 手柄激活態(tài) */::-webkit-scrollbar-thumb:window-inactive { background: rgba(200,200,200,0.4); }回答2:
那就定義瀏覽器滾動(dòng)條樣式即可,兩者是一致的,如果需要不一樣,那就需要模擬滾動(dòng)條
回答3:推薦你參考這篇文章:http://www.qianduan.net/css-custom-scroll-bar-style/作者是微信團(tuán)隊(duì)的神飛,寫的文章一直很不錯(cuò)!
回答4:話說滾動(dòng)更改滾動(dòng)條樣式。為什么pc端可以正常顯示。手機(jī)端就不行了呢
相關(guān)文章:
1. 數(shù)組按鍵值封裝!2. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題3. java - 阿里的開發(fā)手冊(cè)中為什么禁用map來作為查詢的接受類?4. docker不顯示端口映射呢?5. javascript - webpack中alias配置中的“@”是什么意思?6. 主題切換問題,用過別人的webapp在后臺(tái)切換模板主題后手機(jī)端打開網(wǎng)頁就是切換到的主題了7. python - flask _sqlalchemy 能否用中文作為索引條件8. javascript - 為什么創(chuàng)建多行多列的表格最后只有一行內(nèi)有表格9. javascript - ES6規(guī)范下 repeat 函數(shù)報(bào)錯(cuò) Invalid count value10. html5 - 使用echarts中的圖表 一個(gè)頁面導(dǎo)入了好幾個(gè)js圖表 實(shí)現(xiàn)echarts圖表隨著瀏覽器窗口變化而變化時(shí)出現(xiàn)了問題
