CSS table border spacing inside only

I optimized the solution with transparent border so it has no more obliquely cut inner borders.

1) let table fill horizontal and collapse the borders:

table {
  width: 100%;
  border-collapse: collapse;
}

2) Set all borders of table cells to width 0 and prevent background is drawn below the border.

td {
  border: 0px solid transparent;
  background-clip: padding-box;
}

3) Set inner space with transparent border but not to first row and column.

tr > td + td {
  border-left-width: 10px;
}

tr + tr > td {
  border-top-width: 10px;
}

here is a jsbin

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)