Table 1 is a simple table. It features 3 rows and 2 columns and has a 1px border. The cellspacing is the distance between each cell. The cellpadding is the distance the text or image is from the edge of the cell its in.
400px is rather small for a website but I am just showing you the basics of tables. When previewed the table looks like this: The colours have been added so that you can see the cells properly. This is just what the user see's. Behind the scenes we have the HTML code for it. <table width="400" border="1" cellspacing="3" cellpadding="1"> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> Note: This code doesn't have the colours on. You must start with a <table> tag. If you do not state a width the table will be the smallest size possible to fit the data in. You can set the width using either % or px. Depending on your site you can use either. % is a bit more like liquid in a way that it will fill out accordingly to the screen resolution of the users computer. If you use px you can get in problems with people using different screen resolutions. For example, if you create a site of 750px it will fit perfectly on someones screen who has a resolution of 800x600 and a full screen browser. But, if someone is using a resolution of 640x480 or 800x600 with a shrunken browser window they will not be able to see the whole site without scrolling horizontally. The normal table borders are generally not used much in professional sites. The borders are created using CSS styles, but more on that later. Cell spacing: 1px Border: 10px Cell padding: 5px |
Cell spacing: 10px Border: 1px Cell padding: 5px |
Cell spacing: 10px Border: 10px Cell padding: 5px |
| Cell spacing: 1px Border: 10px Cell padding: 10px |
Cell spacing: 1px Border: 10px Cell padding: 10px |
Cell spacing: 1px Border: 10px Cell padding: 10px |
|
These tables show the difference between certain table settings. I generally use this settings on my sites: Cell spacing: 0px Cell padding: 0px Border: 0px I then define the border and padding using CSS code. |