HTML5 tags can be omitted, without affecting the layout of the page, you can save page size. Reduce the amount of code.
Some tags can be omitted.
Omitting the start tag of a tag does not mean that the tag does not exist, it is implied, but it still exists. An HTML file always has a root tag html, even though the string
The opening tag of an HTML tag can be omitted if the first tag inside the HTML tag is not a comment.
The end tag of an HTML tag can be omitted if the HTML tag is not followed immediately by a comment.
The start tag of the head tag can be omitted if the tag is empty, or the tag inside the head is first a tag rather than a comment.
The end tag of the head tag can be omitted if the head tag does not immediately follow a space character or comment.
The start tag of a body tag can be omitted, if the tag is empty, or if the first mark in the body tag is a space character or comment, but the body tag cannot be omitted if the first tag within the body is a script or style tag.
The end tag of a body tag can be omitted if the body tag is not followed immediately by the annotation.
The end tag of the Li Mark can be omitted, if the Li tag is immediately followed by another Li tag or there is no parent tag for more content.
The end tag of a DT mark can be omitted, if the mark of the DT is immediately after another DT mark or a DD mark.
The end tag of the DD tag can be omitted if the DD is immediately followed by another DD or dt tag, or if there is no more content for the parent tag subsequently.
The end tag of the p tag can be omitted if the P tag is followed immediately by an address, article, aside, blockquote, dir, Div, DL, fieldset, footer, form, H1, H2, H3, H4, H5, H6, Header, Hgroup, HR, menu, NAV, OL, p, Pre, section, table, UL, tag, or if there is no more parent tag content and the parent tag is not a tag.
The end tag of an RT tag can be omitted if the RT tag immediately follows RT or RP tags, or more content without a parent tag.
The end tag of an RP tag can be omitted if the RP tag is immediately followed by RT or RP tags, or there is no more content than the parent tag.
The end tag of a optgroup tag can be omitted if the Optgroup tag immediately follows another optgroup tag, or if there is no more content for the parent tag.
The end tag of an option tag can be omitted if the option tag is immediately followed by another option tag, or immediately after a optgroup tag, or there is no further content for the parent tag.
The opening tag of the colgroup tag can be omitted if the first mark within the Colgroup tag is a col tag, or if the tag is not followed by another colgroup tag, and its closing tag has been omitted. (Colgroup cannot be ignored if the tag is empty.) )
The end tag of the colgroup tag can be omitted if the colgroup tag is not immediately followed by a space character or comment.
The end tag of the thead tag can be omitted if the thead tag is followed by a tbody or tfoot tag.
The start tag of the tbody tag can be omitted if the inside tbody tag is first a TR tag, if the tag has not been omitted from the end tag after the tbody,thead,tfoot tag. (It cannot be ignored if the tag is empty.) )
The end tag of the tbody tag can be omitted if the tbody tag is immediately followed by a tbody or tfoot tag, or if there is no more content after the parent tag.
The end tag of the TFOOT tag can be omitted if the tfoot tag is immediately followed by a tbody tag, or if there is no more content after the parent tag.
The end tag of a TR tag can be omitted if the TR tag immediately follows another TR tag, or if there is no more content after the parent tag.
The end tag of a TD tag can be omitted if the TD tag is immediately following the td,th tag, or if there is no more content for the parent tag.
The end tag of a th tag can be omitted if the th tag is immediately followed by the td,th tag, or if there is no more content after the parent tag.
However, if the start tag has any one or more attributes, it cannot be omitted.