User:LeeA/sandbox change3

tables 3

Table column headings

 * We have a title for our table, but what do the columns represent?
 * To label the columns we use exclamation marks: !
 * Unlike the caption, we have to have a row tag before the exclamation marks:

 |- !  !  !  !

 |- ! Fruits ! Vegetables ! Nuts ! Grains
 * Here are the column headings for our healthy foods table:


 * NOTICE there are no borders on column headings.
 * NOTICE the headings centered by default in the heading cell.
 * NOTICE the font is bold as well.

Changing column headings
Here is what the table will look like with borders, centered text and background color: Here is the coding: 
 * To put a border on the heading cells, we will use our border attribute
 * To make the headings really stand out let's add a background color as well.
 * NOTICE the width attribute was moved into the heading tags so we know where they are. They could have stayed where they were or with any other cells in the columns.

Try these out


 Exercises
 * With our above table place a yellow border, "dashed" style and 10 pixels thick.
 * Make the table 500 pixels wide.
 * Next place a blue border around the headings.
 * Install our Healthy Foods caption with any font;
 * Install the headings for each of the columns.
 * Install a background color for the headings.

Check your answers

 Quick Quiz
 * The headers are always centered on the column.
 * A. True
 * B. False

*You can put borders in the headers column
 * A. True
 * B. False


 * Headers are always in bold type.
 * A. True
 * B. False

Check your answers

Editing cells
So far we learned how to make changes to the captions and headings of our table. In addition, we can do all the same things to individual cells, but for these attributes to apply it requires them to be placed into every cell.
 * We can change the size of the font with the font-size attribute.
 * We can change the alignment in the cell.'''????where"""
 * We can change the font with the font-family attribute.
 * We can change the background color of the cells. background-color attribute.
 * We can change the style of font with our bold and italic tags. (this is done by using the ' mark a certain number of times to accomplished the desired effect.)

Here is the example of all of the above possibilities for each cell, with a change of font size, font-family, background color along with some padding

Here is the code for all of the changes we made

| style="border:1px solid red; width:25%; font-family:Rockwell; font-size:20px; text-align:center; background-color:lightblue" | Apples

'''*NOTICE The padding in the other cells do not move the text to the right. To move the text over the padding must be put into each individual cell.'''

'''*We will now learn more about adding padding around the text in the cells. '''

Cell padding

 * We will use this table for our demonstrations:


 * Let's add 10 pixels of padding to the first row of cells:


 * NOTICE how all the cells in the row have expanded.(Expands all the way around the text and moves the text over to the right by about 10px.)

Here is the coding:




 * When applying padding to column labels, you only have to put the padding attribute in the first cell of the row to affect all the cells in the row.

Cell separation
Another way to create space between material in cells is to place a space between the cells themselves.
 * This requires the border-spacing attribute: border-spacing: 3px.
 * This attribute can only be added to the opening table tag . Here is what our table will look like with a cell separation of 3 pixels:

Here is the coding: 


 * If you are changing text for the entire row, there is another way.
 * See the next chapter after you have completed the exercises and quick quiz below.

Eliminate border spacing
If we want to have the individual cells with their borders up against each other, we use the border-collapse:collapse attribute. This coding goes only in the table tag.

This is the coding; style="border:1px solid red; width:70%; border-collapse:collapse"

Our table would look like this if we used this attribute:

Try these out


 Exercises
 * With our above table place a black border, "dotted" style and 5 pixels thick.
 * Make the table 600 pixels wide.
 * Next place a blue border around all the cells.
 * Place 5 pixels of padding in the header row of cells
 * Separate all the cells with 5 pixels.
 * Place a lightblue background on the column headers.

Check your answers

 Quick Quiz
 * Only the border-collaspe attribute is required to separate cell borders.
 * A. True
 * B. False


 * Padding attribute only pads on the left side of the text
 * A. True
 * B. False


 * The header font cannot be changed
 * A. True
 * B. False

Check your answers