Re:[2] Inheritance of alignment for TD

> >Well the spec, http://www.w3.org/TR/html401/struct/tables.html#alignment, says
> >#IMPLIED just as you mention. But the comments below it says:
> >
> >"align = left|center|right|justify|char [CI]
> >   This attribute specifies the alignment of data and
> >   the justification of text in a cell. Possible values:
> >     left: Left-flush data/Left-justify text. This is
> >           the default value for table data. "
> >
> >One could interpret this like this:
> >   The browser MUST use ALIGN="LEFT" as the default value.
> >   For left-to-right text that is.
>
> That passage contains an error.  If there is a default value for an attribute it is listed in the DTD, distinctly different from #IMPLIED.
>
> align is defined like this in the DTD:
> align (left|center|right|justify|char) #IMPLIED
>
> For that passage to be correct, it would have to be defined like this:
> align (left|center|right|justify|char) left

That was what I was afraid of...
In this case the DTD rules and the comment
  "This is the default value for table data."
should be removed to avoid confusion in the future.

I guess I'll have to put in a defult alignment for TD's in my stylesheet
after all.

> The problem arises from the fact that W3 wants there to be a different default value for this attribute depending which element it is
> used with, but that is simply not conveyed in the DTD.  As everyone knows, you can't have your cake and eat it too.  So, I do
> not interpret that to mean the browser MUST use align="left", I interpret it as a misguided suggestion that the UA should use
> align="left".  The statement you quoted above is later contradicted by this statement: "The default alignment for cells depends on
> the user agent. However, user agents should substitute the default attribute for the current directionality (i.e., not just "left" in all
> cases).".  So "This is the default value for table data" should be removed.  At the very least it would have to be changed to "This would make a good default
> value for languages that are written from left-to-right", but that is obviously ridiculous.
>
>
> >This is not the case here, since the browser having "problems" (IE6)
> >actually does align TD's to the left, if there are no surrounding tags. See
> >the example "A normal table".
>
> I don't understand your problem, isn't that what you're suggesting it should be doing?  Bye the way, I don't have IE 6 so I can't see the page the same as you.

If there are no surrounding tags IE6 does what it should, or at least what
browsers have been doing since the last ice-age:
  TD's without an ALIGN attribute are aligned to the LEFT

But when there is a tag that has an align="center", and that tag surrounds
the TABLE of the TD with no alignment, the TD inherits the align="center"
from the surrounding tag and is center-aligned. View the source of
the example "A table within a center-aligned div-tag" in the test page and
you'll see what I mean:
  http://www.mdh.se/ie6.html

/Dennis

Received on Saturday, 20 October 2001 15:47:16 UTC