
Photo: Richard Lee
Navigation
Introduction
Natura11y offers an assortment of responsive navigation and menu choices.
Generic Navigation
Create a simple vertical navigation with the .nav component class added to a <ul> tag (Figure 1).
<ul class="nav"> <li> <a href="#1">Link</a> </li> <li> <a href="#1">Link</a> </li> <li> <a href="#1">Link</a> </li> </ul>For a horizontal menu, apply the .nav--horizontal modifier class (Figure 2).
<ul class="nav nav--horizontal"> <li> <a href="#1">Link</a> </li> <li> <a href="#1">Link</a> </li> <li> <a href="#1">Link</a> </li> </ul>Breakpoint Modifiers
The .nav--horizontal modifier accepts breakpoint modifiers.
With the HTML in Figure 3, the nav starts in the vertical direction. It then changes to the horizontal direction at the large breakpoint.
<ul class="nav nav--horizontal--lg"> ... </ul>Justification
Use the flex justify content utilities for centered or right-justified navigation (Figure 4).
Bordered Navigation
Add the .nav--divider modifier class to a .nav selector for a vertical, bordered navigation (Figure 5).
Include the aforementioned .nav--horizontal and .nav--horizontal--{bp} modifier classes to .nav--divider selectors. This produces a horizontal (and responsive) bordered menu (Figure 6).
Icons in Navigation
Icons are supported within any .nav — no modifier class required. Icon styles apply automatically.
Nav items with icons (<a> or <button>) require two child selectors. The first child is a <span> with its combined icon classes. The second child is a <span> with a .nav__text class, which holds the item’s text. The .nav__text selector is the target for underlining on :hover and :focus states, and provides spacing between the icon and text. See Figure 7.
<ul class="nav"> <li> <a href="#1"> <span class="icon icon-home" aria-hidden="true"></span> <span class="nav__text">Home</span> </a> </li> <li> <a href="#1"> <span class="icon icon-calendar" aria-hidden="true"></span> <span class="nav__text">Calendar</span> </a> </li> <li> <a href="#1"> <span class="icon icon-bell" aria-hidden="true"></span> <span class="nav__text">Notifications</span> </a> </li> </ul>
<ul class="nav nav--divider"> ... </ul>Dropdown Items
Include dropdown items within .nav and .nav--divider selectors, as well as within the .main-menu__nav selector inside the main menu component.
Learn about dropdowns, link–dropdown combos, and mega menus.
Related Custom Properties
Navigation spacing and typography can be customized by redefining the related CSS custom properties.
:root { --nav-gap: 0.875em; --nav-divider-padding-x: var(--container-padding-x); --nav-divider-padding-y: 0.625em; --nav-font-family: var(--font-family-sans-serif);}| Custom property | Default | Purpose |
|---|---|---|
--nav-gap | 0.875em | Gap between items in unbordered navigation lists. |
--nav-divider-padding-x | var(--container-padding-x) | Inline padding of bordered navigation items. |
--nav-divider-padding-y | 0.625em | Block padding of bordered navigation items. |
--nav-font-family | var(--font-family-sans-serif) | Font family applied to navigation lists. |


