I have 20 rows like this in a standard html table (table>tbody>tr>td) without a header.
current situation
<table>
<tbody>
<tr>
<td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td>3</td>
</tr>
<tr>
<td>4</td>
</tr>
<tr>
<td>5</td>
</tr>
<tr>
<td>6</td>
</tr>
<tr>
<td>7</td>
</tr>
<tr>
<td>8</td>
</tr>
<tr>
<td>9</td>
</tr>
<tr>
<td>10</td>
</tr>
<tr>
<td>11</td>
</tr>
<tr>
<td>12</td>
</tr>
<tr>
<td>13</td>
</tr>
<tr>
<td>14</td>
</tr>
<tr>
<td>15</td>
</tr>
<tr>
<td>16</td>
</tr>
<tr>
<td>17</td>
</tr>
<tr>
<td>18</td>
</tr>
<tr>
<td>19</td>
</tr>
<tr>
<td>20</td>
</tr>
</tbody>
</table>
I would like to render this like:
desired result
When i use flexbox it will sort 1,2 next line 3,4 etc.
I found loads of results on how to do other things, but not this. I remember it could be done without javascript and without modifying the html – and it was a pure css-thing couple lines long, but can’t find that doc anymore. Also searched on stackoverflow, nowhere to be found. If anyone can put me into the correct direction – thanks!
3
Answers
The trick is to make sure the
width
is50%
and you need to gravitate to the left, likeHere is something that comes close, using CSS columns and
display
parameters different from the original (table) ones:CSS grid can also do the job