頁面HTML: css代碼: ...
頁面HTML:
1 <div class="inner"> 2 <div class="innerbox"> 3 <p style="height:200px;">這是內容111</p> 4 <p style="height:400px;">這裡是內容222</p> 5 <p>這裡是內容333</p> 6 </div> 7 </div>
css代碼:
1 .inner{ 2 width: 265px; 3 height: 400px; 4 position: absolute; 5 top: 33px; 6 left: 13px; 7 /*cursor: pointer;*/ 8 overflow:hidden; 9 } 10 .innerbox{ 11 overflow-x: hidden; 12 overflow-y: auto; 13 color: #000; 14 font-size: .7rem; 15 font-family: "\5FAE\8F6F\96C5\9ED1",Helvetica,"黑體",Arial,Tahoma; 16 height: 100%; 17 } 18 /*滾動條樣式*/ 19 .innerbox::-webkit-scrollbar {/*滾動條整體樣式*/ 20 width: 4px; /*高寬分別對應橫豎滾動條的尺寸*/ 21 height: 4px; 22 } 23 .innerbox::-webkit-scrollbar-thumb {/*滾動條裡面小方塊*/ 24 border-radius: 5px; 25 -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2); 26 background: rgba(0,0,0,0.2); 27 } 28 .innerbox::-webkit-scrollbar-track {/*滾動條裡面軌道*/ 29 -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2); 30 border-radius: 0; 31 background: rgba(0,0,0,0.1); 32 }