<table id="table_id"> <tr> <td>testtesttesttest</td> <td>testtesttesttest</td> </tr> </table>
I would like that if the table does not fit on the screen, then to the second cell of the table will be transferred to another row down? Not the text in the cell, but the whole cell.
The space between two rows in a table can be done using CSS border-spacing and border-collapse property. The border-spacing property is used to set the spaces between cells of a table and border-collapse property is used to specify whether the border of table is collapse or not.
You should not be doing that... is not a valid HTMl markup... Rows can not be wraped by divs.
Change the cells to inline blocks:
#table_id { display: block; } #table_id td { display: inline-block; } td { background: green }
<table id="table_id"> <tr> <td>testtesttesttest</td> <td>testtesttesttest</td> </tr> </table>
jsfiddle
This can't be done with a table, the "row and column" grid is fixed.
However you could use inline-block
elements:
<div id="container"> <div>testtesttesttest</div> <div>testtesttesttest</div> </div>
CSS:
#container>div {display:inline-block;vertical-align:top}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With