3 ms·
This is actually very tricky subject. In short: HTML is SGML application, and in SGML features section (http://www.w3.org/TR/html401/sgml/sgmldecl.html http://w
by rimantas 16y ago
This is actually very tricky subject. In short:
HTML is SGML application, and in SGML features section (http://www.w3.org/TR/html401/sgml/sgmldecl.html http://www.w3.org/TR/html401/sgml/sgmldecl.html) it has this little tidbit: SHORTTAG YES. This allows the usage of so called null-end tags: ability to close the tag with a single character, which happens to be solidus ("/").
So in essence <br/> in HTML should mean the same as <br>>, i.e. "/" closes the tag and then ">" is just some text.
If you try to validate document using xhtml markup as html you may get this warning from validator:
NET-enabling start-tag requires SHORTTAG YES
The sequence <FOO /> can be interpreted in at least two different
ways, depending on the DOCTYPE of the document. For HTML 4.01
Strict, the '/' terminates the tag <FOO (with an implied '>').
However, since many browsers don't interpret it this way, even
in the presence of an HTML 4.01 Strict DOCTYPE, it is best to
avoid it completely in pure HTML documents and reserve its use
solely for those written in XHTML.
In XML (and hence XHTML) with the help of some mind-boggling trickery (Web SGML Adaptations Annex) you can have things like <foo/>