In the following JSFiddle: http://jsfiddle.net/TVNnT/5/
I would like my list on the right (in blue) to be visible at all times, so I've given it a position fixed so that it follows the browser's vertical scroll bar when the user scrolls down. The content in this list is dynamically added and can grow to a large list. When there isn't enough content on the page and too many items in the list, it gets cut off. How do I ensure that the items in my list are always visible? I've been playing with the CSS for a while and can't seem to figure this out.
My HTML structure:
<body>
<div>
<div id="mainContent">
main content
</div>
</div>
<div id="list">
<ol>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
<li>item 4</li>
</ol>
</div>
</body>
My CSS:
body {
background: #1b242b;
font-family:"lucida grande", tahoma, verdana, arial, sans-serif;
font-size: 16px;
overflow-y: scroll;
}
#mainContent {
background-color: pink;
position: relative;
width: 300px;
padding-top: 30px;
padding-bottom: 40px;
padding-right: 10px;
padding-left: 60px;
}
#list {
background-color: lightblue;
position: fixed;
overflow: hidden;
float: left;
width: 150px;
min-height: 15px;
font-size: 15px;
top: 20px;
margin-left: 400px;
padding-right: 20px;
}
What am I missing? Thanks!