Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valid html tag to group definition list items

Tags:

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?

like image 819
Jon Hadley Avatar asked Aug 24 '09 09:08

Jon Hadley


People also ask

Which HTML tags define a list of items?

<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> ).

What HTML tag is used to group elements?

The <fieldset> tag is used to group related elements in a form. The <fieldset> tag draws a box around the related elements.

Which tag is used to define definition list?

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.

How do you group items together in HTML?

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.


1 Answers

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.

like image 94
Aaron Digulla Avatar answered Oct 12 '22 06:10

Aaron Digulla