Search code examples
htmlcss-tables

Applying a spacing between different cells


I was trying to put some horizontal spacing between the table cells here:

http://jsfiddle.net/mVX93/43/

However the only thing I was able to do to get it to appear correctly was to put a thick border the same colour of the background a bit like this:

border: 10px solid gray;

Is there not a better way to put spacing between the cells?


Solution

  • Change your code to this:

    #my-table td{
        padding-left: 10px;
        padding-right: 10px;
        vertical-align: top;
        background-color: white;
    }
    

    Remove this line

    border-collapse: collapse;
    

    to see your space between cells better