Re: HTML Improvement/Suggestion

Anne van Kesteren wrote:

> DTDs are ingored, but did you ever play with XML (or XHTML) as opposed 
> to HTML?
> You can do all funny things you want to do. Like nesting <div> inside 
> <span> et
> cetera.

Define "can".

In XML, elements are arbitrary and have no meaning. You can nest 
whatever you want in everything else, and the document will be well-formed.
But specific XML languages, such as XHTML, go beyond that and define the 
document structure. A non-validating parser will accept a div inside a 
span for XHTML, but it is invalid according to the standard and all 
schemas, and a validating parser will reject it.
The same in HTML: it's invalid, but browsers will accept it because 
they're very forgiving. However, the results of this, especially the 
display behaviour of showing a block element inside an inline element, 
are undefined. You can't rely on a behaviour.

Sebastian Redl

Received on Monday, 12 December 2005 10:01:52 UTC