Beginners’ HTML – Part 3
Challenge Solution
The challenge I set last week was for you to add some links to the pages we’d created, so that users could navigate easily between our 3 pages. We had three pages – the main page, the links page and the pictures page.
On the main page, you should have added some code that looks something like this:
Favorite Links
Pictures
On the links page, you should have something similar to:
Main Page
Main Page
Favorite Links
So now, if you load any one of these pages into your browser, you’ll see that you (and your visitors!) can easily move between the pages.
Tables
Everything you read has structure to it, from that boring shopping list in your pocket, to the latest magazine on your desk. Just like these items, HTML pages should have a structure. I’m sure you could manage to construct a shopping list without too much trouble, but how about a magazine? If we use HTML in the way its original creators intended, the amazing, graphics-intensive sites we see today wouldn’t be possible – all we’d be able to produce would be plain, dull pages.
Tables make up the basic layout of almost every Web page in existence today. On the main page of SitePoint.com, I counted 34 separate tables, all embedded within each other. This shows just how important tables are to both the design and the content elements of a Web page.
To create a table, you will need to use the
tag. You can make as many cells as you want, but each row of the table should have the same number of cells as all the others. So let’s take a look at a basic table:
Now, I know that looks confusing, so let’s go through it section by section. First, we have the
As you can see, it has 3 rows and 3 columns (or cells) in each row. Table SizeBy default, a table will be just large enough for the elements it contains to fit within it, but no bigger or smaller. You can change this default using various ‘height’ and ‘width’ attributes. You can specify a height or width either in pixels, or in percentage of the browser window. For example:
|
