.gdtCont { width:200px; height:300px; border:1px solid #ccc; overflow:hidden; margin:0 auto; position:relative; } .txtCont { width:220px; height:100%; overflow:auto; box-sizing:border-box; padding-left:20px; } .bz-gdtCon { width:6px; position:absolute; top:0; right:0; background:rgba(0,0,0,.5); height:100%; display:none; } .bz-chtgn { width:100%; position:absolute; top:0; left:0; background:rgba(255,255,255,.5); }
自定义滚动条,关键是在计算滚动条比例上