Help:Wiki University HTML-- Tables - Borders

Table Borders
Now that we have a table created, we need to add some borders so it will look more like a table.

Add border attribute in opening table tag
{| style=" border:  1px solid red " Here is the table with the border added:
 * To add a border to a table, add the border attribute to the opening table tag like so:
 * NOTICE the space between the pipe and the word style
 * NOTICE there is no closing tag for this attribute
 * NOTICE the |- row tag acts like a separator between the attribute in the opening table tag and the next cell
 * NOTICE the width of the table is determined by the text in the cells. It does not necessarily go across the page and it might even be wider than the page.

Cell borders
You can also put borders around cells:

Each cell now has its own border. Here is the coding:
 * NOTICE there is NO space between the borders of the cells. We'll let you how to fix that later.
 * NOTICE each cell has the border attribute placed in it. It is a lot of work, but this is the only way it works in the Wiki.
 * NOTICE that a pipe separates the attribute from the text in the cell. The pipe must be there.
 * NOTICE this coding is not required in row tags.

Try these out


 Exercises Check your answers
 * With your table from the previous exercise, put a 15 pixel "ridge" border with a border color of "cornsilk."
 * Put a border for the whole table that is 15 pixels wide, "double" border with a border color of brown.
 * Put a blue border around the cells in the first column 1 pixel thick.

 Quick Quiz
 * Attributes must be separated with a pipe from the contents of the cell
 * A. True
 * B. False


 * You can put borders around rows
 * A. True
 * B. False


 * You can put borders on columns
 * A. True
 * B. False

Check your answers