Preview
Download

Secret Service Wars
Want to Advertise here? Contact Us


Home
Forums
Awards for You
Winners
Awards Won
About Us
Past Layouts
Past Updates


Site Rules
Site FAQ
Site Staff
Credits
Link to Us
Link Exchange
Linkage
Affiliation


Latest Contest
Previous Contest
Contest Winners
Mini Contests
General Rules


100x100 Icons
64x64 Icons
70x70 Icons
AIM Icons
Archived Icons


Signatures
Buttons
Banners
Wallpapers
Enter Signs
Hiatus Signs
LJ Headers
Friends Only Banners


Div Layer
Tables
iFrames
PopUp


Brushes
Extractions
Vectors
Icon Bases
Icon Creator


HTML Tutorials
CSS Turoials
Let's Make a Layout
Graphics Tutorials
Do's and Don'ts











Bassman Themes

Tables CONT

Tables are often used to make layouts... so often people want to be able to change the colors in a table. Since you already know how to change the font color, I'll show you how to change the background color, and/or add an image to the background.
When you want to change the background color you need to decide where you want to do it, so for instance say we want to change the background color of the whole table.
Then we need our table tag.
<table border=4 height=100 width=100 cellspacing=6 cellpadding=6>
And to this tag we're going to add bgcolor=black
So our tag now looks like this:
<table border=4 height=100 width=100 cellspacing=6 cellpadding=6 bgcolor=black>
And of course the outcome:

Hey how is
it going over
there ? ?

Notice now that the background for the table is black instead of the page color, but what if we want the going cell to be navy in color, well then for that specific TD we're going to add a bgcolor=navy to the tag.
So our code for that TD should look like this <td width=30 height=55 bgcolor=navy>going </td>
And the outcome on the page would look like this:

Hey how is
it going over
there ? ?

Now for instance we want to add a image to the background, much like the body tag and adding an image to the page background we're going to put background="images/bg.jpg" into the table tag.
Our table tag should now look like this:
<table border=4 height=100 width=100 cellspacing=6 cellpadding=6 bgcolor=black background="bg.jpg">
And our outcome:

Hey how is
it going over
there ? ?

We can do the same thing to the TDs so, my it cell is now going to have it's own background.
We take our
       <td width=20 height=10>it
       </td>

tag and we add background="bg2.jpg" to it, making the code now look like this:

       <td width=20 height=10 background="bg2.jpg">it
       </td>

And the outcome of course:

Hey how is
it going over
there ? ?

Notice how with the white background you can't read the text... that's a simple fix, by adding a <font color=black> and of course closing it after out text </font> we can remove the visibility problem.
Make sure you add it within the td tags, so around the text desired to be another color and not around the table.
so it would look like this.

Hey how is
it going over
there ? ?

Since we've made a lot of changes, let's take a look at how our code should look like if we had the exact table shown above:

<table border=4 height=100 width=100 cellspacing=6 cellpadding=6 bgcolor=black background="images/bg.jpg">
   <tr>
       <td width=20 height=10 valign=top>Hey
       </td>
       <td width=30 height=55 valign=bottom>how
       </td>
       <td width=50 height=35 valign=top>is
       </td>
   </tr>
   <tr>
       <td width=20 height=10 background="bg2.jpg"><font color=black>it</font>
       </td>
       <td width=30 height=55 bgcolor=navy>going
       </td>
       <td width=50 height=35>over
       </td>
   </tr>
   <tr>
       <td width=20 height=10>there
       </td>
       <td width=30 height=55 align=center>?
       </td>
       <td width=50 height=35 align=center>?
       </td>
   </tr>
</table>

Now it is possible to add various other things, like you can fix the background in a table as well. You can put anything in the cells you want, and so you can apply other things learned to this.
Before we leave tables though we'll learn how to make them stretch.
So lets say we want to remove the over column in the second row, and put over into the going column. Obviously that'll make the table mess up, but there is a way to make that second column stretch the length of two columns.
We can do this by adding in a colspan=2 This will mean that the span of the column is 2 cells.
So let's take a look at the code for that:
   <tr>
       <td width=20 height=10 background="images/bg2.jpg"><font color=black>it</font>
       </td>
       <td width=30 height=55 bgcolor=navy colspan=2>going over
       </td>
   </tr>

notice how the td that use to contain the over has been removed.
The outcome of this would look like this:

Hey how is
it going over
there ? ?

Now you can see the going over, taking up two spaces.
Next we're going to change the rowspan of the "it" cell. This will be similar to the colspan, in that you add the rowspan=2 to the td tag, and remove the other td tag.
So our code will look like this:
   <tr>
       <td width=20 height=10 background="images/bg2.jpg"rowspan=2><font color=black>it <br>there</font>
       </td>
       <td width=30 height=55 bgcolor=navy>going
       </td>
       <td width=50 height=35>over
       </td>
   </tr>
   <tr>
       <td width=30 height=55 align=center>?
       </td>
       <td width=50 height=35 align=center>?
       </td>
   </tr>

And once again the outcome:

Hey how is
it
there
going over
? ?

I threw in a <br> in order to put the there down on the next line, it's not necessary.