Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align two tables horizontally HTML/CSS

Tags:

html

css

I have two tables that align horizontally using this syntax:

<table width=100%>
  <tr>
    <td><table1 code goes here>
    </td>
    <td><table2 code goes here>
    </td>
  </tr>
</table>

This is all fine and dandy and they align if the tables have the same number of data rows. But if one has fewer than the other, then they are still aligned in the same positions, but the other table is shrunk, so they look like:

header
data
data
data    header
data    data
data    data
data    data
data
data

Is there any way to getthem to align from the top down, as well?

Like

header    header
data      data
data      data
data      data
data
data
data
data
data

How can I fix this?

like image 401
user3979986 Avatar asked Dec 12 '22 03:12

user3979986


1 Answers

You can use valign = top.

<table width=100%> 
  <tr> 
    <td valign="top"><table1 code goes here>
    </td>
    <td valign="top"><table2 code goes here>
    </td>
  </tr>
</table>
like image 165
manosim Avatar answered Dec 21 '22 11:12

manosim