Adding Columns to your table

Lesson 5

 

Here is the code for the table that you have so far.

<table align=center border=1 width=90% background=html/backgroundlight.jpg>
<tr>
<td><br>
</td>
</tr>
</table>

I am going to move the </td> so that it's on the same line as its opening counterpart

That will make the next step easier to understand

<table align=center border=1 width=90% background=html/backgroundlight.jpg>
<tr>
<td><br></td>
</tr>
</table>

The area inside your table is called a "cell"

So far we have a one cell table

When there is no width statements included in your table data tag <td>, your browser will ASSUME that the width is 100%.

But now we're going to separate the table into to columns. We must now tell the browser how wide to make each cell in the column. All of the widths added together must equal 100

I am adding another <td> line to show that there will be TWO cells in the same row.

<table align=center border=1 width=90% background=html/backgroundlight.jpg>
<tr>
<td><br></td>

<td><br></td>
</tr>
</table>

Now I have to tell my table how wide to make the cells my adding the width statements to each. For now I will make them each 50%

<table align=center border=1 width=90% background=html/backgroundlight.jpg>

<tr>
<td width=50%><br></td>

<td width=50%><br></td>
</tr>
</table>

My table will now look like this

   

Just for "yucks" lets change the widths to 25% and 75%

Remember they MUST add up to 100

<table align=center border=1 width=90% background=html/backgroundlight.jpg>

<tr>
<td width=25%><br></td>

<td width=75%><br></td>
</tr>
</table>

 

   

Hey this is pretty cool. Lets add one more <td> to make three cells instead of two.

<table align=center border=1 width=90% background=html/backgroundlight.jpg>

<tr>
<td width=33%><br></td>

<td width=33%><br></td>

<td width=34%><br></td>
</tr>
</table>

I now have three <td> lines and the widths all add up to 100. Here what it looks like

     

If your table looks like this. do the CHA CHA, then come back and go to the next lesson.