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.
- 2possible duplicate of How to set cellpadding and cellspacing in CSS?user– user2014-03-07 20:46:53 +00:00Commented Mar 7, 2014 at 20:46
Add a comment |
7 Answers
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.
1 Comment
Tor Valamo
in IE7 and below, you can use the cellspacing attribute in the table tag. You can supply both to get it working in IE also. Other browsers will prioritize the style.
table { border-spacing: 10px; } This worked for me once I removed
border-collapse: separate; from my table tag.
Mine is:
border-spacing: 10px; border-collapse: separate; 1 Comment
ufk
i need to add the boder-collapse css property for the margin to take affect. thanks
Suppose cellspcing / cellpadding / border-spacing property did not worked, you can use the code as follow.
<div class="form-group"> <table width="100%" cellspacing="2px" style="border-spacing: 10px;"> <tr> <td width="47%"> <input type="submit" class="form-control btn btn-info" id="submit" name="Submit" /> </td> <td width="5%"></td> <td width="47%"> <input type="reset" class="form-control btn btn-info" id="reset" name="Reset" /> </td> </tr> </table> </div> I've tried and got succeed while seperate the button by using table-width and make an empty td as 2 or 1% it doesn't return more different.
1 Comment
Md Abul Bashar
the width worked for me as I expected.