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

Neil St.Laurent  wrote:

--"
Is the following then the most correct way to center a table?

<TABLE STYLE="margin-left: auto; margin-right: auto">
"--

That should work in IE, seeing as how other margin declarations work on
TABLE, but it does not. CSS margins don't work on TABLE at all in NSN4.

--"
If not, then what is?
"--

In MSIE, you can declare

  TABLE { text-align: center }

but NSN doesn't support this. So, for the time being we're stuck with <TABLE
ALIGN=center>.

Defining the legacy rendering of TABLEs in terms of CSS properties is
difficult. If ALIGN is the HTML equivalent of text-align, then the fact that
this works on a TABLE in IE seems to imply that the rows and cells must be
inline elements. But if this is the case, what of BORDER? The rendering of
BORDER on a table does not correspond to the equivalent CSS property, and
declaring TABLE borders in CSS has no effect in either IE or N. Obviously,
not every TABLE attribute is going to correspond directly to a single CSS
property, and -- depending on the model -- some might apply to children
(CELLPADDING, CELLSPACING, BORDER) contrary to inheritance rules.

I believe there have been proposals for dealing with tables, but none opened
to public comment. Too bad.

David Perrell

Received on Monday, 20 October 1997 17:01:29 UTC