Question: Can I add a border to tr element in css?

Can I add a border to tr element (in table) in css?

Thanks in advance.
(from CSS newbie)

Not directly: adding a border to a tr isn’t allowed.

But you can target the first and last cell, give those a left/right border respectively.
Then on each cell put a top border and a bottom border on each td element.

There probably will be a catch however: if you have several rows you will need to use border-collapse so you don’t have double borders between your rows.

Thanks! I’ll give it a try.

Yes it is allowed in the collapsing border model.

tr{border:1px solid red}

However, IE6 and 7 don’t honour it so it’s best to put the border on the cells instead as you mentioned :slight_smile:

Paul, you’re right (once again)… but only if you use border-collapse. So my full answer should have been ‘yes, if you also use border-collapse’ :slight_smile: