# Breadcrumb: an accessible trail

> iVOLT breadcrumb: an ordered list of links inside a labelled nav, with a CSS separator and aria-current on the last item. CSS only.

Source: https://ivolt.intervolutions.com/components/breadcrumb · iVOLT 1.1.2 · English

Shows where the current page sits in the site hierarchy. The separator is drawn with CSS so screen readers only read the links.

**CSS:** `css/components/breadcrumb.css` (in `ivolt.css`).

Couldn't load the demo. [Open alone](https://ivolt.intervolutions.com/stage/breadcrumb/basic.html?id=fx-breadcrumb-basic)

```html
<section id="top" class="iv-stack iv-u-gap-4">
  <nav class="iv-breadcrumb" aria-label="Breadcrumb">
    <ol class="iv-breadcrumb__list">
      <li class="iv-breadcrumb__item"><a href="#top">Documentation</a></li>
      <li class="iv-breadcrumb__item"><a href="#top">Components</a></li>
      <li class="iv-breadcrumb__item"><a href="#top">Navigation</a></li>
      <li class="iv-breadcrumb__item" aria-current="page">Breadcrumb</li>
    </ol>
  </nav>
  <h2 class="iv-u-m-0">Breadcrumb</h2>
  <p class="iv-u-m-0">
    The links in this demo point back to this section, so nothing leads to an
    invented page. The separator is a masked SVG on <code>::before</code>: it is
    never announced and it follows the text colour in both themes. The last item
    is plain text marked with <code>aria-current="page"</code>.
  </p>
  <nav class="iv-breadcrumb" aria-label="Breadcrumb, single level">
    <ol class="iv-breadcrumb__list">
      <li class="iv-breadcrumb__item" aria-current="page">Documentation</li>
    </ol>
  </nav>
</section>
```

## Markup

`nav.iv-breadcrumb[aria-label="Breadcrumb"]` → `ol.iv-breadcrumb__list` → `li.iv-breadcrumb__item`. The last item carries `aria-current="page"` and is not a link.

## Common mistakes

- Separator characters typed into the HTML (they get read aloud).
- Linking the current page to itself.

## Full example

The trail is an ordered list, because the order is the meaning. The `nav` gets its own name so it can be told apart from the main navigation in the landmarks list of a screen reader.

```
<nav class="iv-breadcrumb" aria-label="Breadcrumb">
  <ol class="iv-breadcrumb__list">
    <li class="iv-breadcrumb__item"><a href="/">Home</a></li>
    <li class="iv-breadcrumb__item"><a href="/components/button">Components</a></li>
    <li class="iv-breadcrumb__item" aria-current="page">Breadcrumb</li>
  </ol>
</nav>
```

## How the separator works

The separator is a masked inline SVG on `::before`, never a character in the HTML, so it is not announced and it takes the text colour of the theme through `currentColor`. It is drawn only between items (adjacent-sibling selector). The list wraps onto several lines on a narrow screen instead of scrolling sideways.

Locals: `--iv-breadcrumb-gap` (space around the separator) and `--iv-breadcrumb-separator-size`.

## Search engines

The visible trail does not tell a search engine about your hierarchy on its own. If you want breadcrumbs in search results, add a `BreadcrumbList` in JSON-LD with the same items; this site does exactly that on every documentation page.
