主要是体现在代码规范上,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 class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="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 class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="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>
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦