User:Ccsmith/sandbox/wiki2


 * Now that you are familiar with borders, padding, margins, colors, etc., you are ready to advance to learning how to create and edit tables like the one above.
 * Once you are familiar with tables, you will have the tools to create and edit Templates, Sidebars and NavBoxes, so pay close attention to how tables are created.

Opening and closing tags
These two tags open and close a table.
 * Just the opposite of the opening table tag.

Rows
Tables consist of rows with cells. However rows have NO CLOSING tag. Rows are created with a |- |-
 * NOTICE that it consists of a pipe and a dash.

Cells
| Rows are made up of cells where the actual information is displayed. Cells have NO CLOSING tag. Cells are created with just a |
 * NOTICE that it consists only of a pipe.

Tables are many rows of cells
This is wikitext coding for a table with one row populated with four cells:  If we were to load this, we would see nothing because the individual cells must have something in them in order to display:  This is how our beginning table looks on the page:
 * NOTICE the opening and closing table tags
 * NOTICE the row tag has no closing tag
 * NOTICE each cell has no closing tag

To add another row of cells, just repeat the row tag and cell tags:  Here is our table with two rows and four cells in each row 
 * Here is our table so far:


 * NOTICE this table does not look much like a table. Tables usually have borders, column titles, etc.

Table Borders
As we have said, our little table looks like two sentences. Tables usually have borders. To add borders, we use our border attribute: style="border:1px solid black" in the opening table tag: {| style="border:1px solid black" Here is the coding:  Here's what our table looks like with the class wikitable added to the opening table tag:

As you look at the table, you can see that the items are right up against each other and there are no borders around each cell.

Cell Borders and Padding
To add borders to each cell along with padding. We will use our border and padding attributes.  Here's what our table looks like with borders and padding in each cell:

Adding rows and cells
To add rows and cells, add your row tags followed by your cell tags. You can add as many as you like. To find out about having other kinds of borders and background colors go to Advanced Wikitext training

How to structure a list using tables
In lesson four you learned about lists. However, if lists are very long, table are very useful:
 * 1) If there are '''six or less items in a list, place them in one vertical column.
 * 2) If there are seven or more list them in two or more columns like so:

Here is the coding: 
 * NOTICE the padding which will give a little space between the columns.
 * NOTICE there is NO table width stated in the Wikitext table header. Let the browser set the width according to the viewport displaying the table.

Size of cells

 * Size of cells is controlled by what is in them.
 * The size of all the cells in are row are controlled by the cell with the most material in it.
 * The material in the rest of the cells are in the middle of the cell, not at the top.

Vertical alignment

 * To get the material in all the cells to be at the top, we use an attribute called "vertical-align:top."
 * We will add this attribute to the cell tag:
 * Here is what the table looks like now:
 * If we do not want to have the boarder or the background color, leave off the 'class="wikitext"' and this is the finished product.


 * This is the look we are looking for on our pages in the Wiki. Check out any United States state page.

Try these out


 Exercises Check your answers
 * Create a table with four rows and four cells in each row.
 * In the first column list four fruits.
 * In the second column, four vegetables.
 * In the third column, four nuts.
 * In the fourth colomn, four grains.
 * This table will be the basis for all future exercises on tables. (Be careful we are talking about columns not rows.  This exercise will teach you how to arrange items in columns.)

 Quick Quiz
 * Tables do not need a closing tag
 * A. True
 * B. False


 * Rows must have a closing tag
 * A. True
 * b. False


 * Cells must have something in them for the table to be visible.
 * A. True
 * B. False

Check your answers

Vertical alignment
When we place some text in a div or paragraph tag that is taller than the text we are placing, the text will appear at the top of the container. What if we want the text in the middle of the container? To do that, we use the combination of text-align and line-height attributes.  This text is in the middle This text is in the middle.
 * Let's make a container or box with a div tag that is 50px in height with a line of text.
 * Next we need to combine the text-align with line-height.
 * If we set the height of the line-height to 50 pixels, the text will be in the middle of the container. Here is the coding:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sit amet iaculis metus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Fusce elementum efficitur faucibus. Curabitur eleifend quis ligula ac ullamcorper. Curabitur eget suscipit turpis.