The nuts and bolts definitions for HTML/xHTML are expressed using SGML and XML
Document Type Definitions (DTDs.)
This site presents as many of the details found in DTDs as possible,
often using or drawing direct inspiration from DTD concepts. These
DTD details can be fairly difficult to decode on the first through
third (or more!) glance without some major explanation.
A DTD defines, among other things, the syntax of elements and their
attributes. It also specifies "Content Models" for each element -
describing which elements (if any) are directly nestable inside of
a given element. This is accomplished in a DTD using a simplified
BNF syntax that specifies
content order, occurrence and exclusion behaviors for each HTML
Content Models in SGML DTDs only specify allowed HTML element
relationships in terms of element content (which elements are allowed
to directly nest inside of another HTML element.) Obviously, this is only a
one-way relationship definition. This site also lists "Parent Models"
for each element (which elements are allowed as direct parents of a
specific element.) So - how does one come up with these parent
relationships? Thankfully, taking all the element Content Models in
a DTD as a whole *ALSO* implicitly defines all the allowed
Parent Elements for any given element.
In an early HTML 2.0 DTD draft I used long ago, these parent
relationships were explicitly defined alongside the usual Content Models
for each element, and I found this information to be useful - Useful
enough to document and explicitly include on this site as well.
Another bit of syntax which draws inspiration from SGML are the
"Shorthand" notations used for defining Parent and Content Model
groupings. This shorthand form is also used to define the Common
Attributes categories. Throughout the HTML reference site, these
hyperlinked "macros" may be found, beginning and ending with a
"%" character. This syntax is based on an SGML DTD construct known
as a "Parameter Entity" - a form of macro which is used to save time
and space in cross-referencing information within the DTD.
The shorthand macros I have defined (click on the hyperlinks to expand
the macros) are usually directly related to Parameter Entities that
are defined in the HTML 4.0 DTD (eg: the "%Core%" macro on this site
refers to the CLASS, ID and STYLE attributes, while the "%coreattrs"
Parameter Entity in HTML 4.0 refers to the CLASS, ID, STYLE, and TITLE