Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set cellspacing in tables only horizontally

I would like to style the table written below.

<table border="1"   cellspacing="10">
  <tr>
    <th>Month</th>
    <th>Savings</th>  
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

The problem is that cellspacing sets the space between cells both horizontaly and verticaly, I would like it to be done only horizontaly. Is there a way to do this.

like image 282
Borut Flis Avatar asked Oct 19 '12 09:10

Borut Flis


2 Answers

Use the border-spacing CSS property on the table. Browser support is fairly good (excluding mainly IE up to and including IE 7). Example:

table { border-spacing: 10px 0; }
like image 145
Jukka K. Korpela Avatar answered Nov 04 '22 18:11

Jukka K. Korpela


Try CSS

table td{

 padding:0px 10px 0px 10px; /* top right bottom left */

 }
like image 2
Murali Murugesan Avatar answered Nov 04 '22 19:11

Murali Murugesan