Description list

Stacked

The default. A muted label above each value. Wrap each label and value in a div.

Order
#110963
Customer
Emma Wilson
Email
emma.wilson@example.com
Shipping address
12 Harbour Street, Unit 4, Wellington 6011
Coupon
Note

Inline

data-layout="inline" puts the label on the left. Under 40rem it stacks again.

Order
#110963
Customer
Emma Wilson
Email
emma.wilson@example.com
Shipping address
12 Harbour Street, Unit 4, Wellington 6011
Coupon
Note

Grid

data-layout="grid" fills the width with as many columns as fit, at least 14rem each.

Order
#110963
Customer
Emma Wilson
Email
emma.wilson@example.com
Shipping address
12 Harbour Street, Unit 4, Wellington 6011
Coupon
Note

Dividers

data-divided adds a line between rows. It works with every layout.

Order
#110963
Customer
Emma Wilson
Email
emma.wilson@example.com
Shipping address
12 Harbour Street, Unit 4, Wellington 6011
Coupon
Note

Long values

Values wrap, even a string with no spaces.

Tracking URL
https://tracking.example.com/parcels/9f8e7d6c5b4a39281706f5e4d3c2b1a09f8e7d6c5b4a3928
Delivery note
Leave with the neighbour at number 14 if nobody answers, and ring the bell twice because it is quiet.

Behavior

Pure CSS, no script. An empty dd shows a muted dash. A dd that holds only whitespace is not empty for CSS, so mark it with data-empty.

Attributes

Attribute / elementValuesDescription
dl.descThe list. Each pair sits in a div.
dtLabel, muted and small
ddValue. Long text wraps.
data-layoutinline, grid (default stacked)Label on the left, or several columns
data-dividedpresent / absentLines between rows
dd[data-empty]present / absentShows a dash for a dd with only whitespace