I have a very simple html page:
<table>
<tr><th>header1</th><th>header2</th></tr>
<tr><td>item1</td><td>item2</td></tr>
<tr><td>item3</td><td>item4</td></tr>
</table>
With some simple css:
tr {
border:1px solid blue;
}
I would expect this to put a border around the tr
s but it doesn't put a border around it at all. How do I get a border around the tr
?
Add table { border-collapse: collapse; }
.
From the CSS2 specification:
In [the
border-collapse: separate
model], each cell has an individual border. [...] Rows, columns, row groups, and column groups cannot have borders (i.e., user agents must ignore the border properties for those elements).
Your code works, if you want a border
just on the row.
However, if you are looking to have the border
everywhere, you will need to do this:
tr, td, th{
border:1px solid blue;
}
Example: http://jsfiddle.net/jasongennaro/83VjH/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With