Re: align=center

>The stylesheets newsgroup discovered, through trial and error mostly,
>that CSS implementations are imperfect. The consensus for the centre
>problem is: http://home.att.net/%7Esjacct/centre.html
>
>You'll notice that the *intended* method is unsupported.


The first sample file provided [1] is invalid HTML. IMG is only valid within
block and inline level elements [2]. (Also, the <BODY> tag is missing
although that is technically ok since BODY has optional start and end tags).
Furthmore, the STYLE element is commented out.

However, even with those things taken into consideration, you're right, it
doesn't work (IE4). This is because auto isn't supported on margin-left and
margin-right in any browser yet [3].

Other things to note on that page:
<IMG style="text-align:center"> should never center an image. [4]
<P style="text-align:center"><IMG></P> should (and does) center an image,
even in IE4 which the page denies.

In trying to understand all this, however, I have got myself very confused.
What should happen in the case of an inline box being given margin-left
and -right as auto yet it's block level parent having text-align as justify
or left? Does each line box get different margins or does the whole inline
box get margins? What if two inline level elements have different margins
(both auto on one and large percentages on the other, say) and both are
longer than the block parent's width and they meet in the same line box?

Is all this explained anywhere?

[1]: http://home.att.net/~sjacct/centre0.html
[2]: http://www.w3.org/TR/REC-html40-971218/sgml/dtd.html
[3]: http://style.webreview.com/mastergrid.html
[4]: http://www.w3.org/TR/PR-CSS2/text.html#propdef-text-align

--
Ian Hickson
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12   Info: www.geekcode.com
GIT/M/S d->-- s+: a--->? C++(+++)>$ U>*++++ P L+>+++++ E(+)>+++ W+++ N(+) o?
K? w@ O- !M V- PS+ PE- Y+ PGP>+ t 5+++>++++ X- R+(+++) tv b++(+++) DI++
D++(---)>++++ G>+++ e(*)>+++++ h!()(--) !r y?
------END GEEK CODE BLOCK------

Received on Tuesday, 21 April 1998 18:30:57 UTC