页面HTML:

<div class="inner">
     <div class="innerbox">
         <p style="height:200px;">这是内容111</p>
         <p style="height:400px;">这里是内容222</p>
         <p>这里是内容333</p>
     </div>
 </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         }