主要是体现在代码规范上,XHTML规范会更加严格
XHTML 元素必须被正确地嵌套
- 正确示范
<b><i>This text is bold and italic</i></b>
- 错误示范
<b><i>This text is bold and italic</b></i>
XHTML 元素必须被关闭
- 正确示范
<p>This is a paragraph</p>
<p>This is another paragraph</p>
A break: <br />
A horizontal rule: <hr />
An image: <img src="happy.gif" alt="Happy face" />
- 错误示范
<p>This is a paragraph
<p>This is another paragraph
A break: <br>
A horizontal rule: <hr>
An image: <img src="happy.gif" alt="Happy face">
标签名必须用小写字母
- 正确示范
<body>
<p>This is a paragraph</p>
</body>
- 错误示范
<BODY>
<P>This is a paragraph</P>
</BODY>
XHTML 文档必须拥有根元素
- 所有的 XHTML 元素必须被嵌套于 根元素中
<html>
<head> ... </head>
<body> ... </body>
</html>