Help:Wiki University Wikitext--Tables - Scrolling

Table scrolling
Look at the extreme right edge of this page. Do you see a vertical scroll bar? The purpose of scroll bars, as you know, is so you can look at a page that may be longer than your monitor can display at once. Occasionally you may want to insert a very large table that may be to long or wide or both to see all together on a page. To make these large tables useful you can create scroll bars which behave just like the one see on this page.

Scrolling bars
Let pretend that our demonstration table is 900 pixels wide. Here's what it looks like:


 * NOTICE the table expanse way beyond the right edge of the page.

Horizontal scroll bars
{| style="border 1px solid red; width:900px" |- | Apples | Peas. . . . |}
 * First step is to encase the table between opening closing div tags like so:


 * Next we add the overflow:scroll attribute to the beginning div tag like so.
 * 


 * However since the table is so wide, we need to limit the table to the size we want it. Here we add a width attribute, in addition:

Let's add the scrolling and width attribute to the beginning div tag. We will limit the width of the table to 400 pixels:

Here is the coding: {| style="border:1px solid red; " . ..
 * NOTICE the scroll bar on the bottom and a place for a vertical scroll bar.

Vertical scroll bar
To add a vertical scroll bar for very tall tables, just add the height attribute to the beginning div tag like so: {| style="border:1px solid red; " . . . Here is the table with both horizontal and vertical scroll bars:
 * NOTICE we now have active scroll bars horizontally and vertically.
 * Our table is small so the example is not a good one, but you get the idea. On a large table, the scroll bars are a great help.

 Exercises Check your answers >
 * Take our demonstration table and make it 900 pixels width and tall.
 * Then make the table scrollable both horizontally and vertically width a finish width and height of 400 pixels.

 Quick Quiz
 * When creating the horizontal scroll bar, you do not have to set the width.
 * A. True
 * B. False


 * Vertically scroll bars are only useful for very tall tables.
 * A. True
 * B. False


 * You cannot have horizontal and vertical scroll bars at the same time.
 * A. True
 * B. False

Check your answers >