tableExercise.html

Directions

We are going to cheat! It is hard to work with unstyled tables because they appear to be a mess. To alleviate this problem, we will use the following CSS file to put rules on our tables and to make table header cells be yellow. Place this code in a file named table.css.

table, th, td
{
    border: solid 1px black;
    border-collapse:collapse;
}
table
{
    margin-left:auto;
    margin-right:auto;
}
th, td
{
    padding:.5em;
}
th
{
    background-color:#FFFF00;
}

In the head of your HTML document, add this line.


<link rel="stylesheet" href="table.css">

The table styles will then be in force. Make sure the CSS file and your table example are in the same directory.

Create the file tableExercise.html and replicate the page you see here exactly. Validate your code because we do it!

tableExercise HTML page