hemaltrivedi
09-24-2004, 03:00 PM
i have created a very simple example here. what i want is a banner on top of page (50px high and covering 100% of width). just below that banner there are 2 areas - on the left hand side, there is an area (which should only be 150px) which reads nothing but just "Main Menu" and the rest of the part to be blank with white background.
Here's the source code -
<html>
<head>
<title>New Document</title>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#c1c1c1" style="border:1px solid #afafaf">
<tr style="height:50px" valign="middle">
<td colspan="2" width="100%" bgcolor="#dbdbdb">Banner goes here...
</td>
</tr>
<tr valign="middle" style="height:25px">
<td width="150">Main Menu
</td>
<td width="*" bgcolor="#ffffff">
</td>
</tr>
</table>
</body>
</html>
but what happens, atleast on my pc, is that the left hand part (with Main Menu as title) covers up the entire width and the second cell has only tiny space. This happens inspite of my specifying the width of the first cell as 150 and that of the second cell to be relative.
can anyone tell me what is the reason for such a thing? i would like to know how HTML calculates this.
What confuses me more is that, if in the above example, I set the width of the first cell using percentages, say width="5%" then it works perfect. But if i specify in absolute terms - width="150" or style="width:150px" then it doesnt work and takes up the entire width.
i need what is the fundamental behind this.
thanks in advance
Hemal
Here's the source code -
<html>
<head>
<title>New Document</title>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#c1c1c1" style="border:1px solid #afafaf">
<tr style="height:50px" valign="middle">
<td colspan="2" width="100%" bgcolor="#dbdbdb">Banner goes here...
</td>
</tr>
<tr valign="middle" style="height:25px">
<td width="150">Main Menu
</td>
<td width="*" bgcolor="#ffffff">
</td>
</tr>
</table>
</body>
</html>
but what happens, atleast on my pc, is that the left hand part (with Main Menu as title) covers up the entire width and the second cell has only tiny space. This happens inspite of my specifying the width of the first cell as 150 and that of the second cell to be relative.
can anyone tell me what is the reason for such a thing? i would like to know how HTML calculates this.
What confuses me more is that, if in the above example, I set the width of the first cell using percentages, say width="5%" then it works perfect. But if i specify in absolute terms - width="150" or style="width:150px" then it doesnt work and takes up the entire width.
i need what is the fundamental behind this.
thanks in advance
Hemal