Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

li

The list item element represents an individual item within a list structure.

Description

The <li> element represents a single item in a list. It must be a direct child of an <ul> (unordered list), <ol> (ordered list), or <menu> element.

List items can contain any flow content, including text, links, images, and nested lists.

When to Use

  • As a direct child of <ul>, <ol>, or <menu>
  • To wrap individual items in any list structure
  • For navigation menu items (inside <nav> with <ul>)

When Not to Use

  • Outside of a list container — it is invalid HTML
  • For definition list content — use <dt> and <dd>

Basic Usage

In Unordered List

In Ordered List

Rich Content

List items can contain any flow content, not just text.

Nesting Lists

List items can contain nested lists to create hierarchical structures. The nested list must be inside the <li> element.

Value Attribute (Ordered Lists)

In ordered lists, use the value attribute to override the item's number. Subsequent items continue from that value.

Note: The value attribute only applies to <li> elements within <ol>. It has no effect in <ul>.

Markers

VB styles list items through two list-level hooks. Both target only the list's direct <li> children, so a nested list keeps its own bullets or numbers.

  • data-marker="check | arrow | dash | star" on a <ul> replaces the bullet through li::marker. The arrow swaps to a left-pointing glyph in right-to-left text. See custom markers on <ul>.
  • class="meta" lays the items out in a row and puts a separator before each item after the first (li + li::before). data-separator="pipe | dash | slash" changes the separator.

Accessibility

Screen Reader Behavior

  • Announced as "list item" with position (e.g., "bullet, list item 2 of 5")
  • In ordered lists, the number is announced
  • Nested lists announce their nesting level when the reader enters them
  • Users can navigate between items with keyboard shortcuts

Best Practices

  • Always place <li> inside a proper list container
  • Keep list items focused on single concepts
  • Use meaningful content — avoid empty list items
  • Limit nesting depth to 3 levels for usability

Safari / VoiceOver

Safari with VoiceOver can stop announcing a list as a list when it has list-style: none. VB's .inline, .unstyled and .meta lists all set that, so add role="list" where the list structure matters to the reader:

Common Mistakes

  • Wrong: Using <li> outside a list container
  • Wrong: Placing block elements directly between <ul>/<ol> and <li>
  • Wrong: Empty list items for spacing

CSS Properties

Context Property Value
Adjacent items (:where(li + li)) margin-block-start var(--size-xs)
Nested list (li > ul, li > ol) margin-block-start var(--size-xs)
Direct children of .inline, .unstyled and .meta lists margin-block-start 0
Direct children of any [data-layout] list (stack, cluster, grid, …) margin-block-start 0
ul[data-marker] > li ::marker content, color Character token (--marker-check, --marker-arrow, …)
.meta > li + li ::before content var(--sep-list) (middle dot) or the data-separator token

The adjacent-item margin is wrapped in :where(), so it has zero specificity: any plain author rule such as li { margin: 0 } overrides it without a class or !important. The flex and grid resets exist because a block margin in a row or grid shows up as a cross-axis offset or a doubled gap.

Attributes

Attribute Context Description
value Inside <ol> only Override the item's ordinal number

Related

  • <ul> — Unordered list container
  • <ol> — Ordered list container
  • <menu> — Semantic container for action buttons
  • <dl> — Definition list (uses <dt>/<dd> instead)
  • <nav> — Navigation container for menu lists
  • reversed — li value and the other numbering attributes
↑