W3C home > Mailing lists > Public > www-style@w3.org > April 1998

Re: align=center

From: Chris Lilley <chris@w3.org>
Date: Fri, 24 Apr 1998 23:19:48 +0200
Message-ID: <354101F4.DE2A025C@w3.org>
To: Ian Hickson <exxieh@bath.ac.uk>
CC: Sue Jordan <sjacct@worldnet.att.net>, "'Style Sheet mailing list'" <www-style@w3.org>
Ian Hickson wrote:

> 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).

Yup

> Furthmore, the STYLE element is commented out.

Actually, it isn't. I agree it looks that way.

The contents of the STYLE element are in another notation entirely; they
are not SGML. Thus, <!-- is not a comment open delimiter. It's actually
whitespace (more or less). The comment open delimiter in CSS is /*

The reason for putting these apparent comment delimiters in is for
downlevel compatibility - the parsing rules for HTML are that unknown
elements are dealt with by stripping out the unknown start and end tags.
In which case, you would get raw CSS in the SGML input stream, which
would mess up any SGML parsers (as if browsers used such things). More
concretely, the CSS gets shown as literal text which annoys people.


> Other things to note on that page:
> <IMG style="text-align:center"> should never center an image. [4]

Correct.

> <P style="text-align:center"><IMG></P> should (and does) center an image,
> even in IE4 which the page denies.

Yes. This is the preferred method, the </P> being used to get a little
extra space after the image (ducks) ;-)

> 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?

Yes, check out what the CSS2 spec says about margins and inline
elements.

I'm not giving you a precise URL; you seem motivated to finds out the
answer and I am motivated to find out if the CSS2 spec is clearly laid
out, well indexed and adequately explained ;-)

--
Chris
Received on Friday, 24 April 1998 17:40:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:55 GMT