题
我的系统中有一个垂直菜单,它基本上由带有CSS样式的HTML ul
/ li
组成(见下图)。但是我不希望<=>项目比菜单更宽,我希望它们溢出菜单底部的水平滚动条。我怎么能在CSS中做到这一点?
解决方案
ul {
overflow: auto; // allow li's to overflow w/ scroll bar
// at the bottom of the menu
}
li {
white-space: nowrap; // stop the wrapping in the first place
}
其他提示
您还需要将样式设为ul:
ul{
width:250px;
overflow:auto;
}
不隶属于 StackOverflow