Reputation: 6236
I have a table with 2 columns
<table border="2">
<tr>
<td>
<div id="menupage" >
...
...
</div>
</td>
<td align="center" >
<div id="contentpage" >
...
...
</div>
</td>
</tr>
</table>
I want to keep always in top not in center if the size of <div id="contentpage" >
is big
Upvotes: 6
Views: 10806
Reputation: 18334
You probably are looking at valign
or vertical-align
.
<td align="center" valign="top">
<div id="contentpage">
</div>
</td>
See http://jsfiddle.net/nivas/Y84pS/
Note that valign
is a deprecated attribute (so are align
and border
. See Index of Attributes for a complete list.). The recommended way to get these functionality is via CSS, using vertical-align
, text-align
and border
.
The second table in my jsfiddle example uses CSS, and gets the same functionality.
Upvotes: 4
Reputation: 13947
If you're going to use tables then you might as well just use valign
.
eg: <div id="menupage" valign="top">
If you want to use CSS you can use vertical-align
.
You could set all td's in your stylesheet like so:
td {
vertical-align: top;
}
I've no idea of your experience etc so I won't go on, but you should avoid tables for layout. You'll save yourself a lot of downvotes and "don't use tables" comments.
Upvotes: 2
Reputation: 16269
You can use the CSS
vertical-align
property to align the TD
contents to the TOP
:
vertical-align:top;
See this working Fiddle Example!
e.g.,
<table border="2">
<tr>
<td style="vertical-align:top;">
<div id="menupage">
...
</div>
</td>
<td align="center" style="vertical-align:top;">
<div id="contentpage" >
...
</div>
</td>
</tr>
</table>
Upvotes: 11