Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to render 2 html tables next to each other?

Tags:

html

css

I'm trying to render 2 tables next to each other horizontally like this:

|Table 1| |Table 2|
|---------| |----------|
|---------| |----------|
|---------| |----------|

What is proper way to do that?


Currently, I got this html:

<div style="vertical-align:top;">
 <table style="display:inline-table;">
  ...1st table
 </table>
 <table  style="display:inline-table;">
  ...2nd table
 </table>
</div>

Having troubles with vertical alignment, it renders out like this (table#2 has 1 less row):

|Table 1|
|---------| |Table 2|
|---------| |----------|
|---------| |----------|

I would like it to start from top.

P.s. There is related question, but I don't want to wrap it around w/ divs.

like image 315
Arnis Lapsa Avatar asked Sep 19 '11 09:09

Arnis Lapsa


1 Answers

Try adding vertical-align: top or using float: left instead of display:inline-table.

like image 131
NiematojakTomasz Avatar answered Sep 24 '22 03:09

NiematojakTomasz