I am not getting a scroll-bar for box in chrome but getting in fire fox and internet explorer
li.box{
border-radius: 0px;
padding:0;
border: solid 1px #8c8d8e;
overflow: hidden;
overflow-y:scroll;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
background-color: #ffffff;
opacity: 0.85;
}
this is JSFiddle link http://jsfiddle.net/wydsf2vk/
将height属性添加到css类,以显示需要设置div的修复高度的滚动条。
Are you by chance using a track pad instead of a mouse, on OSX? There's some quirk where the scrollbar will be hidden if you're using a track pad. Plug in a mouse and see if it appears.
I just checked your fiddle, that's happening because you've not added the overflow-y: scroll;
property to the fiddle. It does work for my version (Chrome too).
change your css:-
height:100px
border-radius: 0px;
padding:0;
border: solid 1px #8c8d8e;
overflow: hidden;
overflow-y:scroll;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
background-color: #ffffff;
opacity: 0.85;
设置该.box的最大高度它将起作用
You are missing the height
CSS property. check snippet below.
.box { border-radius: 0px; padding:0; border: solid 1px #8c8d8e; overflow: hidden; overflow-y:scroll; height: 100px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; background-color: #ffffff; opacity: 0.85; }
<div class="box"> <p> Hello World 1 </p> <p> Hello World 2 </p> <p> Hello World 3 </p> <p> Hello World 4 </p> <p> Hello World 5 </p> </div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.