I currently have:
<dl>
<span class="wrapper">
<dt>A title</dt>
<dd>A description</dd>
</span>
<span class="wrapper">
<dt>A title</dt>
<dd>A description</dd>
</span>
</dl>
This (or divs instead of spans) doesn't validate. Is there anything I could wrap it with that would?
<li>: The List Item element. The <li> HTML element is used to represent an item in a list. It must be contained in a parent element: an ordered list ( <ol> ), an unordered list ( <ul> ), or a menu ( <menu> ).
The <fieldset> tag is used to group related elements in a form. The <fieldset> tag draws a box around the related elements.
The <dl> tag in HTML is used to represent the description list. This tag is used with <dt> and <dd> tag. In HTML4. 1, it defines definition list and in HTML5, it defines description list.
The <div> tag is used to group other HTML content together. The <div> element doesn't add or change the content of your HTML. Instead, its main purpose is to provide an easy way to target and each group.
No. A dl
allows only two kinds of children: dt
and dd
. See this article for a longer explanation.
In short: the reason why dt
and dd
aren't "grouped" is that you can have one or more dt
elements per dd
.
If you really need to group, then your only option is to build the list manually using <ul>
/<ol>
with the necessary CSS.
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