How to add space between two rows in a table with CSS?

Spread the love

Sometimes, we want to add space between two rows in a table with CSS.

In this article, we’ll look at how to add space between two rows in a table with CSS.

How to add space between two rows in a table with CSS?

To add space between two rows in a table with CSS, we can use the border-collapse and border-spacing properties.

For instance, we write

<table id="albums" cellspacing="0">
  ...
</table>

to add a table.

Then we write

table#albums {
  border-collapse: separate;
  border-spacing: 0 5px;
}

to add spacing between cells with border-spacing: 0 5px;.

And we keep the cell borders separate with border-collapse: separate;.

Conclusion

To add space between two rows in a table with CSS, we can use the border-collapse and border-spacing properties.

Leave a Reply

Your email address will not be published.