Top
Best
New

Posted by ravenical 7 hours ago

On The <dl> (2021)(benmyers.dev)
288 points | 88 commentspage 2
rickstanley 6 hours ago|
I've used this a good amount of times, when I coded in front end projects. The first time gave me that satisfying feeling of using the right tool for the job, like completing a puzzle of HTML semantics. I remember JAWS not announcing it correctly in 2018, not sure if it's better now.
wizzwizz4 6 hours ago|
When I checked in 2024 or 2025, Windows Narrator announced it differently in Chrome, Firefox, Edge (Chromium mode) and Edge (IE mode), and none of them worked how I would expect them to. Adrian Roselli's verdict (https://adrianroselli.com/2025/01/updated-brief-note-on-desc...):

> Description list support continues to be generally good (with VoiceOver still the outlier), even if you may not like how it is supported.

You shouldn't try to fix this kind of thing by mangling the HTML, since (1) users tend to be used to their screen reader's quirks, and (2) in situations like these, making it juuuust right in one screen reader is likely to make it incomprehensible in another. But it is important to be aware of these quirks, so you don't accidentally design an interface that relies on less-quirky behaviour.

tln 5 hours ago||
> Admittedly, however, support for the <dl> element is not yet universal.

Wait what? <DL> has been in HTML since.. the first draft in 1993!

I like DL's but they can be challenging to style. This article is using a lot of fixed pixel widths which would break on really small screens or larger data.

extra88 1 hour ago||
Well, it took about a decade for web standards to become a real thing and a lot longer for Web Platform Tests to come to be. Still, while there are lots of tests for DOM construction and visual rendering, testing construction of the accessibility tree is lacking (also keyboard interaction testing).

And that's just for browsers, there's no shared spec for the operating system accessibility APIs the browsers' accessibility tree has to be translated into or how screen readers (and other assistive technologies) will use the OS's APIs.

3eb7988a1663 4 hours ago|||
Granted, I do not know what I am doing with CSS, but the Character Sheet example seems standard flexible elements?

Some of the extracted CSS chunks

  #statblock{
    box-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 10px 10px -5px rgba(0,0,0,.04);
    font-family:Lato,'Trebuchet MS',sans-serif;
    font-size:85%;
    min-width:50ch;
    max-width:70ch;
    margin-inline:auto;
    background-color:#fffaf0;
    padding-inline:2rem;
    padding-block:1rem
  }
  dl.statblock-bio{
    color:maroon;
    line-height:1.5;
    border-top:5px solid maroon;
    border-bottom:5px solid maroon;
    margin-block:0.75em;
    padding-block:0.75em
  }
  dl.ability-scores{
    min-width:40ch;
    display:flex;
    justify-content:space-around;
    color:maroon
  }
  dl.ability-scores>div{
    text-align:center;
    line-height:1.5
  }
  dl.ability-scores dt{
    font-weight:700
  }
WorldMaker 2 hours ago||
I've found CSS Grid is extremely useful for styling DLs.
Telemakhos 6 hours ago||
I was a bit surprised to see nested <div>s given as some sort of precursor pattern, when <dl> was part of HTML before 2.0 back in the days of table layout.
xigoi 3 hours ago|
It’s probably aimed at React developers, many of which are probably not even aware that elements other than <div> exist.
shermantanktop 5 hours ago||
The <dl> tag seems to cover a subset of a broad semantic space, but doesn’t easily extend beyond adding another <dd>.

I dunno, I guess I’m a caveman. If it looks right and works (including accessibility) then I figure I’m pursuing something that doesn’t matter a lot.

callc 4 hours ago|
Shameless plug: you might be interested in https://calvinlc.com/p/2026/02/11/everything-is-a-div.html

I need to learn more about web accessibility, but if you completely ignore it (and other sane practices) HTML looks really simple.

I think the design of HTML is just too much. There’s so many tags that don’t do much. It’s like w3c decided that any common thing people use in websites needs a tag. The end result is more and more tags…

Can anyone convince me otherwise? It screams design red-flags to me.

PS: I love the web and think it’s the best platform and future platform we have at the moment. It’s just quirky and loves not breaking old websites!

extra88 1 hour ago|||
lol, you should actually read the HTML spec, there are good explanations of all the elements. The whole point of defining semantics is that elements have meaning independent of their default appearance (or any appearance).

> I need to learn more about web accessibility, but if you completely ignore it (and other sane practices) HTML looks really simple.

Everything looks really simple when you ignore vast amounts of the subject and nuance.

Your rules don't mention keyboard or focus behavior, the only mention of either is the association between <label> and its <input>. <output> does have functionality, it's an HTML-native ARIA live region (that can be associated with a <label>).

https://html.spec.whatwg.org/multipage/

shermantanktop 3 hours ago|||
Oh that’s great. It’s an opinionated view that focused strictly on the behavior of the tags wrt layout and appearance.

I’ve noticed that discussions of semantic meaning of tags often contain the word “feel.” Nothing wrong with that, taste matters, but it does point to the non-functional goals that are being pursued when people disagree.

<ol> vs <ul> - they are both ordered, because markup is ordered. One gets decorated differently than the other by default. Is the difference semantic or typographical?

bulatb 2 hours ago||
A <ul> is a list of things whose order makes no difference to its meaning. Rearranging a <ul> would change the presentation, not the information. Rearranging an <ol> would change both.

  <ul> Players
    <li> Alice
    <li> Bob
    <li> Carol
  </ul>

  <ol> Leaderboard
    <li> Bob
    <li> Alice
    <li> Carol
  </ol>
bulatb 30 minutes ago|||
Too late to edit now, but I should mention putting titles in a list like that isn't valid. It's just to shorten the example.
shermantanktop 56 minutes ago|||
Exactly. “Unordered” implies “reordering doesn’t change meaning.” And yet that’s already implicit in the bullets (vs numbers).

So is it a decoration hint? Or is it actually semantic? And what system is interpreting the semantics rather than the visual presentation?

bulatb 8 minutes ago||
HyperText Markup Language is semantic. You're marking up a document to show what information it contains, where it contains it, and how it relates to other documents or information. Reading markup causes browsers to display things, but that's incidental.

In theory.

In practice, no one cares about semantics and the tags are chosen based on how a target set of browsers happens to display them.

turtleyacht 7 hours ago||
Hoped to see CSS for the alternative, where <div> is not nested inside the <dl>. Too used to thinking of div as "layout containers."
WorldMaker 2 hours ago|
CSS Grid is a very good friend when trying to style DL without extra DIV wrappers. An example:

    dl {
        display: grid;
        grid-template-columns: 1fr 3fr;
        grid-template-rows: auto;
    }

    dt {
        grid-column-start: 1;
    }

    dd {
        grid-column-start: 2;
    }
That very simply puts terms side-by-side data in a nice obvious way. (Even with multiple DDs per DT.) A bit like the Wikipedia screenshot in the article but that's more balanced `grid-template-columns: 1fr 1fr;`. (But that's the flexibility of CSS Grid, right? Real easy to tweak this further for your needs/interests/design.)
michalc 6 hours ago||
The GOV.UK Design System summary list component is a description list https://design-system.service.gov.uk/components/summary-list...

And... it also uses the wrapper div for styling

9dev 5 hours ago|
The wrapper div is making me a bit sad. These days, using grid layout, you don’t actually need it in most cases
petepete 3 hours ago|||
The problem with 'in most cases' when it comes to a design system that's used in hundreds of different ways across departments and services, is that some week break.

I don't really like the div either (I use the design system all day, and maintain a set of components), but it makes documentation much easier.

Theodores 4 hours ago|||
Absolutely!

I put dl lists in a grid with no divs needed. As MDN says, div is the last resort, invariably there is something better, and nowadays that is grid styling.

New to me is multiple dd's.

For legacy layouts littered with divs and classes, display: contents helps get rid of the div wrappers, promoting whatever is wrapped.

Even with disclosure elements there are ways to avoid div wrappers using the pseudo element for everything enclosed by the details element apart from the summary element.

gabriela_c 3 hours ago||
I loved the character sheet example! Fun!
Finnucane 4 hours ago||
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.
gbeardish 6 hours ago|
What about multiple '&lt;dt&gt;' for one or more '&lt;dd&gt;'?
More comments...