View Full Version : Borders on <tr>

Mar 7th, 2005, 10:03 PM
Is there a way to put a border on a <tr>?

Isn't it very stupid that it is not possible by default?

Mar 7th, 2005, 10:38 PM
Using CSS? If so, write this in the stylesheet:

tr { border: 1px solid black; }

Of course, you can use whatever size and color you like, just change it!

Mar 8th, 2005, 03:03 PM
Am I a complete fool if it doesn't work?

Mar 8th, 2005, 03:24 PM
I think table rows are supposed to be purely semantic (i.e. not styled). You're not a fool, I tested it with FF's CSS editor on this page with a 3px solid red (just in case I missed it ;) ) border on table rows and it didn't work. You'll probably have to style your <th> elements, <td> elements, and/or <table> elements to get what you're looking for.

Mar 8th, 2005, 04:05 PM
You know, I may have been thinking about the cells instead of the rows. Hmm...

Mar 8th, 2005, 04:23 PM
If all else fails: check the specs!
From the section on table borders (http://www.w3.org/TR/2004/CR-CSS21-20040225/tables.html#borders) it doesn't appear that rows can be styled; instead, style the cells within the row to achieve the desired effect.