How to display table in two columns

Igor Ostapiuk picture Igor Ostapiuk · Jan 18, 2018 · Viewed 11.8k times · Source

In view I have table:

<table class="table table-hover table-striped">
     ....
</table>

I want to see next result in view:

table_row_1 | table_row_2 
table_row_3 | table_row_4 
table_row_5 | table_row_6 
etc.

Answer

JoostS picture JoostS · Jan 18, 2018

How about this:

table, tr, td, thead, tbody {display: block!important;}
tr {float: left!important; width: 50%!important;}
<table class="table table-hover table-striped">
     <tr><td>1</td></tr>
     <tr><td>2</td></tr>
     <tr><td>3</td></tr>
     <tr><td>4</td></tr>
</table>

I used !important because we most likely have to overrule Twitter Bootstrap (according to your class names). It would be better to NOT use !important and copy the Bootstrap classes/declarations (and make them slightly more specific), but this is just for simplicity and to prove this solution works.