CSS valign table

Post Reply
mister_v
Posts: 188
Joined: Thu Mar 04, 2010 9:19 pm

CSS valign table

Post by mister_v »

Hi,

I would like to align the cells in my table to top.
In HTML it works with valign=top.
But I'm now trying to work with CSS and it doesn't work.

here is my code:

Code: Select all

<table class=test_table>
 <tr>
  <td>cell1</td>
  <td>cel2
         test</td>
 </tr>
</table>
CSS code in separated CSS file:

Code: Select all

.test_table{width:100%;valign:top;}
chris
Site Admin
Posts: 194
Joined: Mon Jul 21, 2008 9:52 am

Re: CSS valign table

Post by chris »

you are looking for vertical-align:top (equals valign=top in html)

But I think it won't work for the entire table,
you'll have to put (a separated class) in <tr> or <td>

so something like this:

Code: Select all

<table class=test_table>
 <tr class=test_tr>
  <td>cell1</td>
  <td>cel2
         test</td>
 </tr>
</table>
css file:
.test_table{width:100%;}
.test_tr{valign:top;}
Post Reply