Page 1 of 1

CSS valign table

Posted: Tue Mar 05, 2013 8:03 pm
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;}

Re: CSS valign table

Posted: Mon Mar 18, 2013 5:37 pm
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;}