Translator Note : There is no time to study in haste, hoping to discuss and refine the explanatory part (now the explanation is not very comprehensive).
Here is a list of tag nesting rules that must be followed under HTML 4 Strict and XHTML 1.0 Strict, such as you can't embed a <a> in <a>.
Description :
- For the convenience of readers, the labels in this article use uppercase (according to XHTML rules, element names must be lowercase, such as
- Lowercase words indicate a group or series of HTML tags
- Each entry (label) follows a list of labels and, if not, indicates that the entry (label) is not allowed to contain any labels inside. This means that the entry can contain only plain text content (#PCDATA, see below). If indicated (empty), this means that the entry is not allowed to contain any form of content.
- #PCDATA means "parsed character data", that is, plain text content (excluding any HTML tags, but escape content can exist, such as Ä and ä)
- CDATA means "character data," meaning that the plain text content of the escaped content is not included, and the details can refer to CDATA confusion
- Excluding ... means not directly or indirectly including the listed elements
Note 1: The above content is based on the Strict DTD for [HTML 4.01 specification].
NOTE 2: for XHTML 1.0, basically consistent, different points are as follows:
- For <script> and <style> content, in HTML 4 is CDATA and in XHTML it is #PCDATA
- ,<table> tags in XHTML can be followed by a <tr>, while in HTML 4.01, this is not allowed, but <tbody> tags can be omitted. This means that if the <table> in the code is followed by <tr>, for HTML 4.01, a <tbody> tag will be generated implicitly, but not in XHTML. This affects the style sheet using tbody as the selector.