Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UL or DIV vertical scrollbar

Tags:

css

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> 
like image 349
Damir Avatar asked Nov 05 '10 01:11

Damir


People also ask

How do I add a scroll bar to UL?

Is there any way to add the scroll bar for it? A: You can try to add the scroll bar for submenu manually. For this purpose you should open your page where you added the css3menu in any text editor and add class="scroll" into the <ul></ul> tag. You can also change the value of 'max-height' parameter.

How do I make my div scrollable vertically?

For vertical scrollable bar use the x and y axis. Set the overflow-x:hidden; and overflow-y:auto; that will automatically hide the horizontal scroll bar and present only vertical scrollbar. Here the scroll div will be vertically scrollable.

How do I make a div scrollable vertically and horizontally?

We can use a combination of overflow-x and overflow-y to place the scrollbar vertically, horizontally, or both. For the vertical scrollbar, overflow-x:hidden and overflow-y:auto will be set in the CSS file, and vice versa for the horizontal scrollbar.


1 Answers

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> 
like image 188
subosito Avatar answered Oct 04 '22 02:10

subosito