Page 1 of 1

[SOLVED]How to vertically align a table row

Posted: Tue Jan 13, 2004 2:23 pm
by vigge89
I'm creating the layout for my new "community", and I'm currently at positioning the right side menu (number 2 on the image). But i've came across some problems. The question is: how can i vertically align number 2 to the top? on default, it positions itself in the middle of the row/col, and stays there ( :P ). I've succeded in doing this before, but i've forgot how i did it.

So, how do i make the content of the row/column appear on the top of it?
Are there any stylish ( ;) ) way to do it in CSS, and also, can it be done in normal HTML???

Also, zoom in to see the image properly ;)
White borders are the main layout table, and the black ones are for each "section"

Image

Edit: forgot the image ;)

Posted: Tue Jan 13, 2004 3:50 pm
by uberpolak
The cell which contains the menu table should have the "valign" attribute set to "top." Like this:

Code: Select all

...
<td valign="top">
    <table>
     ...
    </table>
</td>
...

Posted: Wed Jan 14, 2004 3:16 am
by twigletmac
You can also use CSS for this:

Code: Select all

<td style="vertical-align: top;">
    ....
</td>
Since the sites I work on very rarely want a middle alignment in table cells, I always set the following in my style sheet to force it to top alignment by default for all table cells (I also set horizontal alignment to left and a few other bits and bobs to override the default browser behaviours):

Code: Select all

TD &#123; vertical-align: top; &#125;
Mac

Posted: Wed Jan 14, 2004 8:28 am
by vigge89
thanks, it's working now :D