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.