I have a section of the web page I am building that is dedicated to news events. These are simply entered as follows currently.
<tr>
<td class="newsdate">
February 2013
</td>
<td class="news">
News item 1
</td>
</tr>
<tr>
<td class="newsdate">
January 2013
</td>
<td class="news">
News items 2
</td>
</tr>
I would like to have it so that when there are more than 5 events listed, say, then you can use a scroll bar to see old events. That is the height of the news section will be fixed but you can scroll up and down within it to see newer and older news. How can you do this most simply?
Wrap your table
in a div
using overflow-y: auto;
like this
HTML
<div class="scrollable">
<!-- Your table -->
</div>
CSS
.scrollable {
height: 100px; /* or any value */
overflow-y: auto;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With