I am trying to add a table with space between cell as the background colour of the cell is white and the background color of the table is blue, you can easily see that padding and margin are not working (I am applying it to the td
), it will only add space inside of the 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.
Use the border-spacing property on the table element to set the spacing between cells. Make sure border-collapse is set to separate (or there will be a single border between each cell instead of a separate border around each one that can have spacing between them).
You want border-spacing
:
<table style="border-spacing: 10px;">
Or in a CSS block somewhere:
table { border-spacing: 10px; }
See quirksmode on border-spacing
. Be aware that border-spacing
does not work on IE7 and below.
table { border-spacing: 10px; }
This worked for me once I removed
border-collapse: separate;
from my table tag.
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