|
TABLES
|
||||||
![]() |
|
|
||||
|
![]() |
|||||
|
|
|||||
|
The simplest table is a single cell structure like this one. In the simplest terms it is a table of one row and one column, and these have to be defined. The code for a table is <table>, the code for a row is <tr> and the code for a cell is <td> (table division - columns are made by cells from different rows stacking up on top of each other). Each tag has an end tag, and cells go inside rows which in turn go inside tables. This means that the code for a basic one cell table is:
with the content going in the middle. In other words if we put our frog in the table the code will be:
So you can see the table we'll give it a border of one pixel, and we're also gonna give it a caption at the bottom. This one's new on me, but very useful with pictures. The full code will be:
You can also apply font instructions to the caption; and here I've aligned the table to the right to let the text run round it. Try viewing my source code to see how I've done it. Do all this to the page tables1.html you prepared earlier, typing the table code in in front of the h1 text, save and view. |
|
When you build a table in rows and columns you start by building rows with as many cells (otherwise known as table divisions <td>) as you want columns. The cells in the different rows automatically line up with each other to make columns. First we're going to build a table with one row and three columns. On a new HTML page that you've called TABLES 2 and saved as tables2.html key the following code into the body section:
Save and view (the code means non-breaking space - if you don't put this into an empty cell Netscape browsers won't recognise any background images or colours in that cell so you do it just in case). Then click on my double view and compare. Notice that I've already given the page properties such as background, text and link colours. I just use the <div> tag to align things in the centre. |
|
To build another two rows all you have to is take the highlighted text, copy it, and then paste it twice inside the table (either at the start or the end)
|
ON LINE JONES