dl-item

Groups a dt/dd pair within a description list for built-in layout variants.

Description

The <dl-item> custom element groups a <dt>/<dd> pair within a <dl> for styling. Apply class variants on the parent <dl> to get built-in layouts — no custom CSS needed.

Variants

Class Description
.horizontal Side-by-side key-value rows (grid layout)
.stacked Label above value (flex column)
.bordered Separator lines between items
.compact Tight spacing for dense data
data-striped Alternating row backgrounds

Variants compose freely — combine .horizontal, .bordered, and .compact on a single <dl>.

Horizontal

Side-by-side key-value pairs. Combine with .bordered for separator lines between rows.

Stacked

Label above value with muted term styling. Good for metadata or profile fields.

Compact

Tighter spacing for dense data. Combine with .horizontal and .bordered.

Striped

Alternating row backgrounds using the data-striped attribute — the same attribute used on plain <dl> elements.

Multiple Values

A single <dl-item> can hold one <dt> with multiple <dd> elements.

Why a Custom Element?

HTML5 allows wrapping <dt>/<dd> pairs in <div>, but <dl-item> is more specific than <div> in both CSS selectors and code readability. It describes its purpose — grouping a description list item — without carrying the ambiguity of a generic container.

Content Model

Permitted Content

  • One or more <dt> elements
  • One or more <dd> elements
  • The <dt> elements should come before <dd> elements

Required Parent

Must be a direct child of <dl>.

Related

  • <dl> — Description list container (required parent)
  • <dt> — Definition term (the key/label)
  • <dd> — Definition description (the value)