I want to have a list grow upwards (not downward) inside a div. Then to scroll the list within that div when there are too many li
items. Is this combination possible?
The scrolling is easy - fix the height of the div and set the style of that div to overflow-y: scroll;
The bottom vertical aligned li was tricky and I chose the simplest solution which was to style the containing div as position: relative;
and the ul within as position: absolute; bottom: 0;
But I want both behaviours. Unfortunately achieving the bottom vertical aligned li breaks the scrolling. Or rather, the scrolling happens but I can't drag scroll with the mouse anymore - the scrollbar doesn't appear either.
Here is the fiddle http://jsfiddle.net/tcab/Am3uL/
Here is my html
<div>
<ul>
<li>six</li>
<li>five</li>
<li>four</li>
<li>three</li>
<li>two</li>
<li>one</li>
</ul>
</div>
and here are the relevant styles
div.scroll {
overflow-y: scroll;
}
.bottomalign_ul {
position: absolute;
bottom: 0;
}
.bottomalign {
position: relative;
}
Basically I want to apply all three styles at once - and get the desired effect.
$('div').addClass('bottomalign');
$('ul').addClass('bottomalign_ul');
$('div').height(100);
$('div').addClass('scroll');
Though this sort of works, the list is merely clipped within the div and I can't scroll it with the mouse anymore.