Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • We've always used this in our ebooks for abbreviation and glossary lists. The problem I've always had is that you need to use a bit of css to make two lined-up columns. I've done it with floats. Now, some ebook readers will support grid and flex-box, which give better results, but the Kindle still does not. Kindle is sort of the IE6 of the ebook world.
  • The final example of the DnD statt sheet makes me think whether it's legal to nest <dl>s?

    I.e. can we do

        <dl>
          <dt>Actions</dt>
          <dd><dl>...</dl></dd>
        </dl>
  • Here's a useful note on how well screen readers support DL: https://adrianroselli.com/2025/01/updated-brief-note-on-desc...
  • > Prior to HTML5, this was called a definition list. This is because the <dl> was originally only intended to represent glossaries of terms and their definitions.

    TIL I’ve been naming it wrong for a decade.

  • The world's first website makes heavy use of <dl>s.

    https://info.cern.ch/hypertext/WWW/TheProject.html

    https://info.cern.ch/ (A landing page of sorts to give context and orientation about the actual first website.)

  • List history (listory?) lesson, kids: As the link below to a 1985 IBM mainframe DCF/GML manual shows, DL-DT-DD have been a thing since before the web. In addition to Definition lists (DL), the 40+ year-old documentation describes Glossary lists (GL), Ordered lists (OL), Unordered lists (UL), and Simple lists (SL).

    ibm :: 370 :: DCF :: SH35-0050-2 Document Composition Facility Generalized Markup Language Implementation Guide Rel 3 Mar85

    https://archive.org/details/bitsavers_ibm370DCFSpositionFaci...

  • This is going to be unpopular here, but life became easier when I quit trying to write semantic HTML. It’s just poorly designed, I’m sorry. Every time I’ve reached for a <dl> I’ve eventually regretted it because I wanted multiple levels of wrappers, or a divider between sections, or an icon, or a heading spanning multiple key-value pairs, etc. They make this stuff with some flexibility but nowhere near enough to actually cover the generalized concept it purports to. I still use the corresponding elements when there are observable benefits, of course, like <button>, <h1>, etc, but when all it’s going to do is not quite fit the data model and force me to override everything, it’s just not a practical choice.

    It shouldn’t be so controversial to say that if 99% of usage routes around your API, it’s probably the API’s fault.

    by kqp
  • > <dl aria-label="Ability Scores">

    This is incorrect:

    1. <dl> has no corresponding (viz. implicit) role, but can be given the role group, list, none or presentation <https://w3c.github.io/html-aria/#el-dl>.

    2. You’re only allowed to define aria-label on elements that have a compatible role, implicit or explicit <https://w3c.github.io/html-aria/#docconformance-naming>.

    3. aria-label is allowed on all but a handful of roles <https://www.w3.org/TR/wai-aria-1.2/#aria-label>, which in this case knocks out presentation and none, leaving group and list.

    4. group doesn’t feel right, list feels acceptable.

    In summary: either ditch the aria-label, or add role="list" (meaning also role="listitem" on children).

    —⁂—

    One thing the article misses is that you can have multiple <dt> in a row too, not just <dd>. The spec has a good example: https://html.spec.whatwg.org/multipage/grouping-content.html...

    They’re not name–value pairs, they’re name–value groups.

Explore Birbla archives