HTML Content Categories and Content Models
Categories are not display styles
Flow content is the broad group used in much of the body; phrasing content describes text and inline semantic content, including spans and emphasis. Categories overlap: an image is also embedded content. CSS display cannot change HTML content-model rules.
<output id="result"></output><script> const parsed = new DOMParser().parseFromString("<p><em>Read</em> <span>HTML</span></p>", "text/html"); const result = [...parsed.querySelector("p").children].map(node => node.localName).join(", "); document.querySelector("#result").textContent = String(result);</script>Expected output: em, span
Transparent content models
A transparent portion of a content model inherits the constraints of its surrounding context. An anchor inside a flow container can wrap a paragraph, but it must not contain another anchor, interactive content or a descendant with tabindex. Check the element definition in addition to its categories.
<output id="result"></output><script> const parsed = new DOMParser().parseFromString("<div><a href=\"#notes\"><p>Read notes</p></a></div>", "text/html"); const result = parsed.querySelector("a > p").textContent; document.querySelector("#result").textContent = String(result);</script>Expected output: Read notes
A DOM is not a conformance certificate
The parser can preserve forbidden nesting without an error message. The intentionally invalid example nests a button in a link. Both may exist in the DOM, yet the interaction is not conforming. Use a separate link and button and a conformance checker.
<output id="result"></output><script> const parsed = new DOMParser().parseFromString("<a href=\"#read\"><button type=\"button\">Open</button></a>", "text/html"); const result = Boolean(parsed.querySelector("a button")); document.querySelector("#result").textContent = String(result);</script>Expected output: true
Common mistakes and practice
Use element definitions to check permitted parents, children and special descendant restrictions. Metadata belongs primarily in the head, headings express headings, and sectioning elements organize sections; these categories are not mutually exclusive. Do not infer validity from a screenshot.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Content Categories and Content Models — Knowledge Check
Apply the internals concepts taught in this lesson.
Which category covers text and emphasis?
Can categories overlap?
What determines transparent content constraints?
Is a button nested inside a hyperlink conforming?
Does a recovered DOM prove conformance?