CSS - 垂直滚动到UL列表 [英] CSS - Vertical scrolling to list of ULs
本文介绍了CSS - 垂直滚动到UL列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 UL
和 LI
创建选择
>秒。现在想为列表添加垂直滚动条。所以遵循这个等等stackoverflow查询。从这我得出结论,我需要使用:
Have created a select
box using UL
and LI
s. Now wanted to add verticle scrollbar for the list. So followed this and some more stackoverflow queries. From that I conclude that I would need to use:
overflow-y: auto;
但是没有运气。
如果有超过5个项目可见,我必须添加滚动条。看看 JSFiddle
推荐答案
您是否期望如此。
演示: http://jsfiddle.net/jks0e2zy/4/
Demo: http://jsfiddle.net/jks0e2zy/4/
.select {
cursor:pointer;
display:inline-block;
position:relative;
font:normal 11px/22px Arial, Sans-Serif;
color:black;
border:1px solid #ccc;
min-width:20%;
font-weight: bold;
height: 150px;
overflow-x: hidden;
}
这篇关于CSS - 垂直滚动到UL列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文