Flock of white birds flying

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>
    
Figure 1

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>
    
Figure 2

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>
    
Figure 3

Justification

Use the flex justify content utilities for centered or right-justified navigation (Figure 4).


        <ul class="nav nav--horizontal justify-content-center">
            ...
        </ul> 

        <ul class="nav nav--horizontal justify-content-end">
            ...
        </ul>
    
Figure 4

Bordered Navigation

Add the .nav--divider modifier class to a .nav selector for a vertical, bordered navigation (Figure 5).


        <ul class="nav nav--horizontal--lg">
            ...
        </ul>
    
Figure 5

Include the aformentioned .nav--horizontal and .nav--horizontal--{bp} modifier classes to .nav-divider selectors. This produces a horizontal (and responsive) bordered menu (Figure 6).


        <ul class="nav nav--divider nav--horizontal">
            ...
        </ul>
    
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" role="menu">
            <li>
                <a href="#1">
                    <span class="icon icon-home"></span>
                    <span class="nav__text">Home</span>
                </a>
            </li>
            <li>
                <a href="#1">
                    <span class="icon icon-calendar"></span>
                    <span class="nav__text">Calendar</span>
                </a>
            </li>
            <li>
                <a href="#1">
                    <span class="icon icon-bell"></span>
                    <span class="nav__text">Notifications</span>
                </a>
            </li>
        </ul> 

        <ul class="nav nav--divider" role="menu">
            ...
        </ul>
    
Figure 7


Read Next

Page Footer

Natura11y is an inclusive design ecosystem. It's created and maintained by Avidano Digital, a strategic communications agency serving nonprofit and social impact organizations.

© 2024 - Natura11y Inclusive Framework.All Rights Reserved.