pub struct Nav;Expand description
The <nav> element - navigation links.
§Purpose
The <nav> element represents a section of a page that contains navigation links,
either within the current document or to other documents. Not all groups of links
need to be in a <nav> element—only sections that consist of major navigation blocks.
§Content Categories
- Flow Content
- Sectioning Content
- Palpable Content
§Permitted Content Model
- Flow content (but not
<main>element)
§Common Use Cases
- Primary site navigation (header menu)
- Table of contents
- Pagination controls
- Breadcrumb navigation
- Footer site links
§Key Attributes
- Global attributes only
aria-label: Distinguishes multiple nav elements on same page
§Example
<nav aria-label="Main navigation">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
<li><a href="/products">Products</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
</nav>§Accessibility
- Screen readers provide shortcuts to navigate to
<nav>landmarks - Use
aria-labeloraria-labelledbywhen multiple navs exist - Not every group of links needs to be in
<nav>
§WHATWG Specification
Trait Implementations§
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more