I have six tables side by side. Each table contains a top cell with a header and the next cell with varying amount of text. Each table is set to 30% width and has padding of 10px. The tables are enclosed in an overall <div>
and each table is set float: left
. On a laptop screen these will normally align 3 tables in the top of the screen and then 3 tables underneath.
[1][2][3]
[4][5][6]
However on some browsers or other devices, the text will occupy more space in table 1 making the table longer. This results in table 4 sorting under table 2 rather than under table 1, e.g.
[1][2][3]
[4][5]
[6]
Is there some way whereby I can get them to line up sequentially always taking up the left most space first?
Code example:
table,
td {
border: 1px solid black;
}
table {
float: left;
width: 30%;
margin: 10px;
}
<div>
<table>
<tbody>
<tr>
<td>Title 1</td>
<td>Text text text text text text text text Text text text text text text text text</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>Title 2</td>
<td>Text text text text text text text text</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>Title 3</td>
<td>Text text text text text text text text</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>Title 4</td>
<td>Text text text text text text text text</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>Title 5</td>
<td>Text text text text text text text text</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td>Title 6</td>
<td>Text text text text text text text text</td>
</tr>
</tbody>
</table>
</div>