5 HTML Concepts You Didn’t Know
by @j9t on , tagged html, concepts · Tweet this?
HTML is so important, large, and complex, it warrants a pilgrimage. The specification includes many gems, whether it’s dark humor or esoteric edge cases. It also contains concepts that not everyone is familiar with. Borrowing from the “HTML Concepts” series, here are five of them.
“Body-ok” relates to link type keywords, and denotes what
link elements are okay to be used in the document body (as opposed to its head).
2. The “Nothing” Content Model
“When an element’s content model is nothing, the element must contain no
Text nodes (other than inter-element whitespace) and no element nodes.” Most HTML elements whose content model is “nothing” are also, for convenience, void elements. (The
template element is an exception.)
3. Constraint Validation
form element (like
input) has attributes that define requirements for the element’s value (like being
required, or setting a
minlength, or following a
pattern), then these requirements (constraints) are being validated by the user agent. Constraints are being validated as long as the element is not barred from it.
4. Indicators for Layout Tables
In order to navigate a table, user agents “are encouraged to find heuristics to determine which tables actually contain data and which are merely being used for layout.” The HTML spec then offers a few heuristics. For example, if there is a
role attribute with a value of
border attribute with a (non-conforming) value of
0, or if there are (also non-conforming)
cellpadding attributes with a value of
0, a table is—probably a layout table.
5. Common Idioms
HTML doesn’t have elements for a number of popular design patterns—but for four of them (as of 2021), it gives recommendations: breadcrumbs, tag clouds, conversations, and footnotes.
—Now you know more, when you hear about “body-ok,” the “nothing” content model, constraint validation, indicators for layout tables, and common idioms. To be continued.