Reputation: 81342
If I have 3 columns for example:
<tr>
<td></td>
<td>Know the width</td>
<td></td>
</tr>
In the 2nd column I know the width, and want this centered for example 777, and want the other 2 sides to take up what is left of the screen (in equal shares), how is this done?
This: simply doesn't work:
<tr>
<td width="*%" > </td>
<td width="777"></td>
<td width="*%"></td>
</tr>
Upvotes: 1
Views: 261
Reputation: 71
The following works with css2 browsers. The textaling is needed in the body for IE6.
<html>
<head>
<style>
body{text-align:center;}
#CenteredDiv{width:400px;margin:auto;background-color:silver;}
</style>
</head>
<body>
<div id="CenteredDiv">Centered Div</div>
</body>
</html>
T
Upvotes: 0
Reputation: 354734
You can use the colgroup
element:
<table>
<colgroup>
<col width="*">
<col width="30">
<col width="*">
</colgroup>
<tr>
<td></td>
<td>Know the width</td>
<td></td>
</tr>
</table>
Upvotes: 4
Reputation: 10672
Using floats would work better in this case. You could setup the middle float to have a fixed size, and the other two can be setup to fill the rest (I don't remember the exact css statements)
Upvotes: 2