I'm trying to show or hide certain dt/dd groups within a dl. Is this valid HTML? Should browsers complain about this or is it legit? I've looked at the dl specs but couldn't find anything saying that the dl can contain something other than dt and dd children. I need to do this as I'm using angularJS which provides this neat way of adding or removing elements from the DOM
<dl>
<dt>Term</dt>
<dd>Definition</dd>
<span ng-if="true">
<dt>Term 2</dt>
<dd>Definition 2</dd>
</span>
</dl>
Grouping with div in dl is now valid per WHATWG HTML, see
https://html.spec.whatwg.org/multipage/semantics.html#the-dl-element
The dl element
Content model:
Either: Zero or more groups each consisting of one or more
dtelements followed by one or moreddelements, optionally intermixed with script-supporting elements.Or: One or more
divelements, optionally intermixed with script-supporting elements.
<dl>
<div>
<dt> Last modified time </dt>
<dd> 2004-12-23T23:33Z </dd>
</div>
<div>
<dt> Recommended update interval </dt>
<dd> 60s </dd>
</div>
<div>
<dt> Authors </dt>
<dt> Editors </dt>
<dd> Robert Rothman </dd>
<dd> Daniel Jackson </dd>
</div>
</dl>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With