Re: With CSS how does one ALIGN block-level elements?

Neil St.Laurent wrote:
--- "
The former <DIV ALIGN=center> would make sure that all block-level
elements are centered, and that the text-alignment is centered as
well.
" ---

Not so in Wintel versions of MSIE4 and NSN4. Both will center a IMG (which
by default is inline, not block), but not a table.

--- "
A TABLE is the only thing that would be centered that is block level
and doesn't just have text in it (as opposed to P or BLOCKQUOTE).
Additionally specifying <DIV ALIGN=CENTER> did not affect the
alignment of the text in the table itself, should not <DIV
STYLE="text-align: center"> center align all of the table text?
" ---

There was discussion about this a short time ago. In order to display a
table in accordance with the HTML spec and/or 'legacy' browser behavior,
there must be text-align and font-weight declarations for TH and TD in the
hypothetical 'default' stylesheet. Those declarations will override
inheritance on table cells, and unless otherwise explicitly declared in the
author's stylesheet, TH will be bold centered and TD will be normal flush
left.

Note that if text-align and font-weight have not been declared in the author
stylesheet for P, TABLE, TR, TH, or TD, and a P is nested inside a TH or TD,
the P element content will be bold centered or normal flush left,
respectively. Inheritance will be from the closest ancestor with an explicit
declaration.

David Perrell

Received on Monday, 20 October 1997 15:32:36 UTC