本文介绍了UL或DIV垂直滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的页面上有垂直滚动条的问题。我有很多的项目里面ul里面的div,我尝试与溢出:auto在样式为div,但它不帮助。如何将垂直滚动条添加到ul或div?
I have problem with vertical scrollbar on my page. I have lot of items inside ul inside div, I tried with overflow:auto in style for div but it doesn't help. How to add scrollbar vertical to ul or div ?
<div id="content">
<p>some text</p>
<ul>
<li>text</li>
.....
<li>text</li>
</div>
推荐答案
您需要定义ul或div的高度, set overflow等于auto如下:
You need to define height of ul or your div and set overflow equals to auto as below:
<ul style="width: 300px; height: 200px; overflow: auto">
<li>text</li>
<li>text</li>
这篇关于UL或DIV垂直滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!