Reputation: 3691
According to this document there are some XHTML
tags, that are not supported in new HTML5
standard, for example big and strike. However when I declare my html document as HTML5
they still work for some reason, consider this example:
<!DOCTYPE html /> <!-- HTML5 decalration -->
<html>
<head>
</head>
<body>
<!-- These tags should not work, because the document is declared as HTML5, but they still work -->
<big>Hello</big>
<strike>123</strike>
</body>
</html>
Same applies vice versa, there many other HTML5
tags that are not supported in XHTML
standard, for example svg tag, however when I declare my document as XHTML
they still work. Consider this example:
<!-- XHTML declaration -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
</head>
<body>
<!-- Should not work because SVG are not supported in XHTML standard -->
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>
</body>
</html>
The browser I used is the current version of Google Chrome
.
Can anyone explain why this is happening? What is the point of declaring the document as HTML5
or XHTML
if the browsers will support both regardless of DOCTYPE
specified?
Upvotes: 0
Views: 155
Reputation: 667
In the first example:
These are so-called deprecated tags that you can still use in HTML5, but they're not recommended. They could be removed any time by browsers (although this is pretty unlucky).
The second example:
Most browsers like Google Chrome or Firefox don't render XHTML as XHTML. They actually render it in HTML5. The things that are different in XHTML are converted to HTML5 using a preprocessor. Because SVG isn't part of XHTML standard, it won't be converted but just stays as it is, and thus displayed like in HTML5.
Upvotes: 1