W3C home > Mailing lists > Public > www-html@w3.org > July 2000

HTML 4 - Table Backgrounds

From: fantasai <fantasai@escape.com>
Date: Sun, 30 Jul 2000 13:24:01 -0400
Message-ID: <398464B0.22174E12@escape.com>
To: www-html@w3.org
<BLOCKQUOTE cite="http://www.w3.org/TR/html4/present/graphics.html#adef-bgcolor">

bgcolor = color [CI]
     Deprecated. This attribute sets the background color for
     the document body or table cells.

   This attribute sets the background color of the canvas for
   the document body (the BODY element) or for tables (the TABLE,
   TR, TH, and TD elements). Additional attributes for specifying
   text color can be used with the BODY element.

</BLOCKQUOTE>

Does a background specified on <table> or <tr> apply to the
cellspacing as well, or just the table cells?

I can interpret as far as applying 'bgcolor' to the table cells,
not to the cellspacing, because this is what is explicitly
defined in the definition of the attribute. The only thing that
can imply coloring the cellspacing is in the prose:

"This attribute sets the background color of the canvas... for
tables (the TABLE, TR, TH, and TD elements)."

Note that this is HTML, not CSS; We don't have a CSS2 table model
here, just a visual representation of the markup. The "canvas" for
tables /can/ be interpreted as the part of the page's canvas where
the table's actual content appears. This does not include the
cellspacing and therefore accommodates the 'bgcolor' definition.

Thus I concluded that 'bgcolor' applies to cells, not cellspacing.

However, I tested various browsers and came up with these results:

      - Nav3 & Nav4 display backgrounds only on table cells.
      - Opera 3, IE3, & IE5 also display backgrounds specified on <table> in
        the cellspacing, but don't do this for <tr>.
      - Amaya paints the background on the entire <table> and the entire <tr>,
        including the cellspacing for both.

I asked the question in netscape.public.mozilla.layout, and the only
person to answer favored the Amaya interpretation.

Then I found the attribute definitions in the HTML 4.01 Transitional DTD:
for <TABLE>:
  bgcolor     %Color;        #IMPLIED  -- background color for cells --
for <TR>:
  bgcolor     %Color;        #IMPLIED  -- background color for row --
for <TD>|<TH>:
  bgcolor     %Color;        #IMPLIED  -- cell background color --


MSIE & Opera I can ignore, since their interpretation is inconsistent.
However, Amaya, *the W3C browser* colors the cellspacing when 'bgcolor'
is defined, for both <table> and <tr>.

Either Amaya has a bug, or the HTML4 spec /and the DTD/ need rewording.
Which is it?
Received on Sunday, 30 July 2000 13:23:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:43 GMT