How to give a border to an HTML table row with CSS?

Spread the love

Sometimes, we want to give a border to an HTML table row with CSS.

In this article, we’ll look at how to give a border to an HTML table row with CSS.

How to give a border to an HTML table row with CSS?

To give a border to an HTML table row with CSS, we set the border-collapse and border properties.

For instance, we write

table {
  border-collapse: collapse;
}

tr:nth-child(3) {
  border: solid thin;
}

to add border-collapse: collapse; to let us apply border styles toi the tr elements.

Then we apply border styles to the 3rd tr element with border: solid thin;.

Conclusion

To give a border to an HTML table row with CSS, we set the border-collapse and border properties.

Leave a Reply

Your email address will not be published. Required fields are marked *