user974967
user974967

Reputation: 2946

html table formatting

Is there any way to specify the size of a table without changing the size of the cells?

In other words, my table has a border around it and I am using it for a menu:

<table width = "500" height = "300">
<tr>
<td>
<a href="mysite.com/contact.html">Contact</a>
</td>
<td rowspan = "2">
This is the area where news and updates will appear on the right hand side.
</td>
</tr>
<tr>
<td>
<a href="mysite.com/links.html">Links</a>
</td>
</tr>
</table>

First of all, is there a better way to do this?

If I change the height of the table like that the cells become too spaced out and the menu starts to look awkward.

Upvotes: 0

Views: 165

Answers (2)

FelipeAls
FelipeAls

Reputation: 22171

Why do you use a table layout? Use div elements and style them as you wish in CSS.

You can specify a certain width for the container and width in percentage for its children, so you've only one value to change.

And don't specify height in CSS, only min-height, or you'll block users from zooming at their will.

edit: and inside one of the div, an unordered list for navigation links :)

Upvotes: 1

Toby
Toby

Reputation: 8792

You shouldn't use tables for layout. Menus in HTML4 should be in an unordered list.

Then you should use CSS to style it however you want.

Upvotes: 2

Related Questions