Re: CSS on invalid HTML

> Every browser does that for HTML. But you surely don't mean elements, 
> but tags, which may be absent in the markup according to the HTML 
> specification.

I think he could mean it either way.  Presented with valid HTML with
permitted missing opening tags, a properly CSS compatible browser must
insert the element corresponding to the omitted tags into the document
object model.  This should be a completely specified process.

However, when presented with invalid markup, the IE family try to build
a document object model, which I believe is, in general, no longer a tree
(even though CSS will see it as a tree), and might, for instance, insert
additional elements when an author attempted to overlap two elements,
or tried to nest a %block element into a %inline context.

Of course, things are simpler for conforming XHTML browsers as CSS really
requires well-formedness not strict validity and conforming browsers are
required to reject not-well-formed documents.  There has, of course, been
much discussion as to whether or not it is commercially realistic to
reject documents, and it should be noted that IE is not an XHTML 
compatible browser, it simply tolerates XHTML syntax as a form of
invalid HTML.

Received on Saturday, 5 June 2004 06:54:43 UTC