今天看了下Chrome的网上商城, 感觉他们的滚动条很特别. 特地看了下他们的代码, 发现了他们做滚动条的各种元素的覆盖, 这个也可以用作select的框覆盖, 相信不久的将来, 这种css设计会用于各种浏览器, 本人在开发IE10内核的项目时, IE10已经是支持这类css, firefox, chrome和safari也是支持的. 特地分享该例子:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <style type="text/css"> .custom-scroll-bar::-webkit-scrollbar{ background:-webkit-linear-gradient(left,rgba(202, 202, 202, 0.07) 0%,rgba(229, 229, 229, 0.07) 100%); width:10px; -webkit-box-shadow:0 0 1px 0 rgba(0,0,0,.15) inset,0 1px 0 0 #fff; box-shadow:0 0 1px 0 rgba(0,0,0,.15) inset,0 1px 0 0 #fff; background-color:#E5E5E5; } .custom-scroll-bar::-webkit-scrollbar, .custom-scroll-bar::-webkit-scrollbar-thumb{ overflow: visible; border-radius:4px; border:solid 1px #A6A6A6; } .custom-scroll-bar::-webkit-scrollbar-button{ background-color:transparent;height:0px;display:block; } .custom-scroll-bar::-webkit-scrollbar-thumb:hover{ background-color: #fff; } </style> </head> <body> <div class="custom-scroll-bar" style="width:100px;height:100px;overflow: auto;"> <div style="width:80px;height:200px;"> dsadasd dsadasd dsadasd dsadasd dsadasd dsadasd dsadasd dsadasd dsadasd dsadasd dsadasd dsadasd </div> </div> </body> </html>