Reputation: 149
Is this semantically correct code?:
<details>
<summary>The <dfn><abbr title="HyperText Markup Language">HTML</abbr></dfn> - the HyperText Markup Language standard markup language for documents designed to be displayed in a web browser.
</summary>
<p>This is typically used with .... </p>
</details>`
The HTML specs says that the definition for a dfn
tag must be a p
tag, a dl
group or a section
. But the same spec for the summary
tag says the contents for the summary
tag can be phrasing content which includes the dfn
tag.
https://html.spec.whatwg.org/#the-dfn-element
The dfn element represents the defining instance of a term. The paragraph, description list group, or section that is the nearest ancestor of the dfn element must also contain the definition(s) for the term given by the dfn element
https://html.spec.whatwg.org/#the-summary-element
Content model: Phrasing content, optionally intermixed with heading content.
https://html.spec.whatwg.org/#phrasing-content-2
a...dfn....kbd...
What if I wanted to have definitions for additional terms in the details
tag, e.g.:
<details>
<summary>The <dfn><abbr title="HyperText Markup Language">HTML</abbr></dfn> - the HyperText Markup Language standard markup language for documents designed to be displayed in a web browser.
</summary>
<d>
<dt><dfn>Term to be defined</dfn><dt>
<dd>Explaining term to be defined.</dd>
<dl>
</details>`
Upvotes: 0
Views: 18