Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Andrew McGivery

Andrew McGivery Avatar
Formerly Fredy

******
Legendary Studio Member

Male
5,742


September 2005
tables for beginners

having trouble understanding tables? well its not as hard as you think it is. to start out a table code, you of couse need to put:

<table>

now how do you do things with the table and what are tables for? well they have many uses. elts start off by explaining things. look at this code:

<table><tr><td>blah</td></tr></table>

now lets make you udnerstand each part of the code.
the <table> starts the code as you might already know.
next thing you notice is <tr> which starts a row.
then theres <td> , which starts a cell.
then it says blah which would be your content.
then finally, it ends all the table with </td></tr></table>.

its very vital that you understand that <tr> starts a row and <td> starts a cell.

to make multiple cells, this is how it might look:

<table><tr><td>CELL 1</td><td>CELL 2</td></tr></table>

notice each cell is ended with </td>, and then a <td> follows to start the next cell.

now, look at this:

<table><tr><td>CELL 1</td><td>CELL 2</td></tr><tr><td>CELL 3</td><td>CELL 4</td></tr></table>

that my friend, is a 4 celled table that has 2 rows, with 2 cells on each row. notice to end a row and start a new one, you have to end the last cell on the row, end the row, and start a new row and cell like you did when you made a 2 celled table.

now that you have the basics on a table down, now your ready to put in the life of the table, the parts of coding that tell the table how to look. first things first, you may want a border on your table. so you'd put:

<table border=1 color=red>

notice the border=1, you can replace 1 with whatever number you want. the higher the number, the thicker the border. and next you see color which makes the border whatever color you want it to be.

theres is more things you can do to spruce up your table, like puting a background in and ect, but i'm going to move on to using table as a spacer. tables can be used to position things by making the table take up space. for example, lets say you wanted something centered, but you didn't want it completly centered, you wanted it off to the left a little. then what you would do is decide how many pixels you want between the left of the page and whatever you want centered. then you would put a table code like folows:

<table><tr><td width=40></td><td valign=top>CENTERED THING HERE</td></table>

theres a few things to explaion there i know. first, theres td width=40. 40 is where you put how far across the page you want the centered thing.then you notice td valign=top. this just makes your centered thing stay in the position its suppose to instead of going down the page. valign stands for vertical alignment.

well, thats all for my tables for beginenrs tutorial. thanks for reading.


k

Elite Charizard

Elite Charizard Avatar
Previously known as The Terminator™

**
Official Member

38


January 2006
IF you use <table><tr><td>Whatever</td><td>Whatever2</td></tr><tr><td colspan=2>Whatever3&4</td></tr></table>
It would show the second row as big as the first.
Don't click Here!
<script>
/*Fooling signature
By The Terminator*/
var Spelling="Signature" //Spelling of Signature
/*Don't edit*/
document.write("Sig" + Spelling + "ture")
</script>
SigSignatureture!
thepokeforums.proboards79.com

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
It depends. Some browsers (like FireFox) tend not to render extra rows if they don't exist. IE is different however, but that's besides the point.

newBookmarkLockedFalling