Empty Elements Must Also Be Closed
Empty elements must either have an end tag or the start tag must end with />.
This is wrong:
This is a break<br>Here comes a horizontal rule:<hr>
Here's an image <img src="happy.gif" alt="Happy face">
This is correct:
This is a break<br />
Here comes a horizontal rule:<hr />
Here's an image <img src="happy.gif" alt="Happy face" />
To make your XHTML compatible with today's browsers, you should add an extra space before the "/" symbol like this: <br />, and this: <hr />.
Attribute Minimization Is Forbidden
This is wrong:
<input type="checkbox" checked>
<input readonly>
<input disabled>
<option selected>
<frame noresize>
This is correct:
<input type="checkbox" checked="checked" />标注部分是自加的,以用来理解。
<input readonly="readonly" />
<input disabled="disabled" />
<option selected="selected" />
<frame noresize="noresize" />
The Lang Attribute
The lang attribute applies to almost every XHTML element. It specifies the language of the content within an element.
If you use the lang attribute in an element, you must add the xml:lang attribute, like this:
<div lang="no" xml:lang="no">Heia Norge!</div>
本文介绍了XHTML中空元素的正确闭合方式,强调了属性最小化的禁止规则,并提到了lang属性的应用,确保XHTML文档的标准化与浏览器兼容性。
201

被折叠的 条评论
为什么被折叠?



