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

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.


Dennis Lundberg <dennis.lundberg@mdh.se> wrote on 10/19/01 10:45:31 AM:
> >Most importantly TD should *not* inherit the ALIGN attribute from any 
> tag outside it's own TABLE
>
>That's not necessarily true.  From the part of the spec that you linked 
>to, I can see why you have that impression, but you left out the all 
>important item 6, lowest in
>precendence, that states that the cell alignment may be "The default 
>attribute value".  Another part of the spec,
>http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.3.4 , states that for 
>an attribute defined as having a default value that is "#IMPLIED" (e.g. align
>attribute of TD), "the default value must be supplied by the user agent 
>(in some cases via inheritance from parent elements)".  So
>the default attribute value can come from a "parent" element.  I wonder if 
>they really mean parent element.  If that were the case,
>the inheritance for a TD would stop at the enclosing TR and could never 
>include the enclosing TABLE, so I'm assuming what they
>really mean is ancestor.  So, if W3 really means "ancestor" element, the 
>TD can inherit the value of the align attribute from an
>element enclosing it's "own" table.
 
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.
 
> >Instead if none of the above applies it should use the default alignment 
> which is LEFT.
>
>Once again referring to the section linked to above, when the default 
>attribute value is "#IMPLIED", that means the user agent
>must supply *a* default value.  A particular browser may by convention 
>have provided "left" for TD elements, but it could be any
>appropriate value.  It's worth noting that the sample style sheet for HTML 
>4.0 in the CSS 2 spec does not define any alignment
>for TD elements.
 
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".
 
> >In the examples found at the adress below, the red table-cells should be 
> aligned to the left. Is that correct?
>
>Not necessarily.  According to the spec, in your document it is up to the 
>user agent to decide the alignment for those cells.  It
>could either use the value of a "parent" element, such as the enclosing TD 
>in your "A table within a centered table cell in another
>table", or the enclosing DIV in your "A table within a center-aligned 
>div-tag", or provide a value of it's choosing.  The spec does
>say "However, user agents should substitute the default attribute for the 
>current directionality (i.e., not just "left" in all cases)", but
>that seems to be a suggestion.  I would really like to know if the W3 
>means "parent" or "ancestor" in 3.3.4 Attribute declarations.
 
Quite right, we're talking about text that flows from left to right.
 
/Dennis

Received on Friday, 19 October 2001 11:41:31 UTC