Previous Message
Next Message

Applying A Border To <tr>

Sent by Philippe Wittenbergh on 23 March 2006 02:02

On Mar 23, 2006, at 5:26 AM, Craig Cook wrote:

> On 3/22/06, Michael Warkentin [EMAIL-REMOVED]> wrote:
>> Is there a specific reason why a border can't be applied to <tr>  
>> elements?
>> It seems kind of counter-intuitive.
> Because <tr> doesn't really "exist" as a rendered element, it merely
> serves to group <td>s and <th>s into a row. A <tr> cannot directly
> contain any content, it MUST contain a <td> or <th> first. Since <tr>
> is an invisible grouping element, CSS can't really be applied directly
> to it, especially box-model type things like margin, padding, and
> borders.

That is not correct.
It is possible to apply a border to the <tr>, but IE win won't apply it.
(and indeed it is not possible to apply margins an padding to a <tr>  
as this element can't have margins or padding).

It works correctly in Firefox, Safari, Opera.

but you must
* use border-collapse:collapse border-model
* the borders on the <td> must be hidden or none or *smaller* than  
the border on the <tr>, otherwise, borders on the <td> paint over the  
border on the <tr> (as the <td> sits on top of the <tr>).

Philippe Wittenbergh

css-discuss [EMAIL-REMOVED]]
IE7b2 testing hub --
List wiki/FAQ --
Supported by --
Previous Message
Next Message

Message thread: