Skip to content

Header

The <header> element defines the header of a web page. It contains the logo, some actionable links, a keyword search, and a navigation. On large screens, the full navigation menu is displayed. On smaller screens, a menu button is displayed. When the menu button is clicked, the full navigation is shown. The menu can be closed by clicking outside of the menu, or by pressing the close button.

<div class="ds-wrapper">
<div class="cmp-university-header">
<div class="obj-limit-width">
<h2 class="cmp-university-header__title">
<a href="https://uga.edu" class="cmp-university-header__link">
<svg width="153" height="9" viewBox="0 0 153 9">
<title>University of Georgia</title>
<path
class="cmp-university-header__logo"
d="M117.2.3c-2.8 0-4.3 2-4.3 4a4 4 0 004.2 4 4 4 0 004.2-4 4 4 0 00-4-4zm2.2 4.3c0 2-.8 3-2 3-1.5 0-2.6-1.4-2.6-3.5 0-1.9 1-3 2.2-3 1.5 0 2.4 1.2 2.4 3.5zM80.7.3c-2.9 0-4.4 2-4.4 4a4 4 0 004.2 4 4 4 0 004.2-4c0-2.3-1.7-4-4-4zm2.1 4.3c0 2-.8 3.2-2 3.2-1.5 0-2.5-1.6-2.5-3.6S79 .9 80.4.9c1.5 0 2.4 1.4 2.4 3.7zM103.8 5v3h-.3c-.7.2-1.6.4-2.4.4-2.8 0-4.7-1.6-4.7-4 0-2.8 2.4-4.1 4.7-4.1 1 0 2.5.4 2.5.4v1.8S102.8 1 101 1c-1.1 0-2.2.7-2.6 2l-.2 1.2c0 2.5 1.5 3.4 3 3.4h.6l.2-.7V5.3c0-1-.7-1.3-.7-1.3h3s-.6.1-.6 1zM137.3 5v3h-.3c-.7.2-1.6.4-2.4.4-2.9 0-4.7-1.6-4.7-4 0-2.8 2.4-4.1 4.7-4.1 1 0 2.4.4 2.4.4v1.8s-.7-1.5-2.4-1.5c-1.1 0-2.2.7-2.6 2l-.2 1.2c0 2.5 1.5 3.4 2.9 3.4h.6c.2-.2.3-.4.3-.7V5.3c0-1-.7-1.3-.7-1.3h3s-.6.1-.6 1zM27.4.4c.4.2.3.8.1 1.3 0 .3-1.1 3-1.6 4.1l-1.5-4.1c-.1-.5-.1-.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2c0 1.5-.7 1.8-.7 1.8H41s-.7-.3-.7-1.8V5h.2c.4 0 .6 0 .8.4l.3.6.7 1.3c.5.7.9 1 2.4 1h.4s-.5-.4-1.4-1.8zM126.4 2.7c0 .6-.2 1-.5 1.3-.2.2-.6.3-1.2.3h-.2V1.5v-.3l.6-.2c.6 0 1.3.5 1.3 1.7zm1.5 3.8l-1-2c.5-.1 1.3-.7 1.3-1.8v-.2a2 2 0 00-.8-1.6c-.5-.3-1-.5-2.2-.5h-3c.2.2.6.6.6 1.8v4.2c0 1.5-.7 1.8-.7 1.8h3.1s-.7-.3-.7-1.8V5h.2c.4 0 .6 0 .8.4l.3.6.7 1.3c.5.7.9 1 2.4 1h.4s-.5-.4-1.4-1.8zM152.2 7.5c0 .4-.3.7-.7.7a.7.7 0 01-.7-.7.7.7 0 011.4 0zm-1.3 0c0 .3.3.6.6.6s.5-.3.5-.6-.2-.5-.5-.5-.6.2-.6.5zm.5.4h-.2v-.7h.5l.1.2-.1.1v.2l.1.2h-.1v-.2H151.3v.2zm0-.4l.2-.1-.2-.1v.2z"
></path>
</svg>
</a>
</h2>
</div>
</div>
<header class="cmp-header">
<div class="cmp-header__title-bar">
<div class="cmp-title-bar">
<div class="cmp-site-title">
<a href="/" class="cmp-site-title__link">
<img
src="/images/logo.svg"
class="cmp-site-title__logo"
alt="Online Learning"
/>
</a>
</div>
<div class="cmp-title-bar__features">
<button
class="cmp-title-bar__menu-toggle js-menu-open"
aria-expanded="false"
aria-controls="main-nav"
>
<svg
viewBox="0 0 16 14"
class="cmp-title-bar__menu-icon"
aria-hidden="true"
>
<path d="M1,1 15,1 M1,7 15,7 M1,13 15,13"></path>
</svg>
Menu
</button>
<div class="cmp-title-bar__actions">
<nav class="cmp-actions-nav">
<a href="#" class="cmp-actions-nav__link">Request Info</a>
<a href="#" class="cmp-actions-nav__link">Apply</a>
</nav>
</div>
<button
class="cmp-title-bar__search-toggle js-search-toggle"
data-icon-hidden="icon-search"
data-icon-expanded="icon-up-arrow"
>
<span class="util-visually-hidden">Search</span>
</button>
</div>
<div class="cmp-header-search js-search">
<form class="cmp-header-search__form">
<div class="cmp-header-search__form-container">
<label class="util-visually-hidden" for="site-search">
Search Online Learning
</label>
<div class="cmp-header-search__field-container">
<input
id="site-search"
class="cmp-header-search__field js-search-field"
type="search"
placeholder="Search"
/>
</div>
<button
class="cmp-header-search__button icon-search"
type="submit"
>
<span class="util-visually-hidden">Submit Search</span>
</button>
</div>
</form>
</div>
</div>
<div class="cmp-nav js-menu" id="main-nav">
<nav aria-label="Main">
<div class="cmp-nav__actions">
<button class="cmp-nav__close js-menu-close">
<svg class="cmp-nav__close-icon" viewBox="0 0 16 16">
<path d="M1,1 15,15 M 1,15, 15,1"></path>
</svg>
Close
</button>
<a href="/" class="cmp-nav__title icon-shield">Online Learning</a>
</div>
<ul class="cmp-nav__list">
<li class="cmp-nav__item">
<a class="cmp-nav__link" href="/demos/future-students.html">
Future Students
</a>
</li>
<li class="cmp-nav__item">
<div class="cmp-nav__subnav-actions">
<a
class="cmp-nav__link"
href="/demos/degrees-and-certificates.html"
>
Degrees &amp; Certificates
</a>
<button
class="cmp-nav__toggle js-subnav"
id="degrees-and-certs"
data-icon-expanded="icon-up-arrow"
data-icon-hidden="icon-down-arrow"
>
<span class="util-visually-hidden">Open Navigation</span>
</button>
</div>
<ul
class="cmp-subnav cmp-subnav--collapsed"
aria-labelledby="degrees-and-certs"
>
<li>
<a href="#" class="cmp-subnav__link">Undergraduate Degrees</a>
</li>
<li>
<a href="#" class="cmp-subnav__link">Graduate Degrees</a>
</li>
<li>
<a href="#" class="cmp-subnav__link">Graduate Certificates</a>
</li>
</ul>
</li>
<li class="cmp-nav__item">
<a class="cmp-nav__link" href="/demos/courses.html">Courses</a>
</li>
<li class="cmp-nav__item">
<a class="cmp-nav__link" href="#">Student Resources</a>
</li>
<li class="cmp-nav__item">
<a class="cmp-nav__link" href="#">Faculty Resources</a>
</li>
<li class="cmp-nav__item">
<a class="cmp-nav__link" href="/demos/news-articles.html">News</a>
</li>
<li class="cmp-nav__item">
<a class="cmp-nav__link" href="#">About</a>
</li>
</ul>
</nav>
</div>
</div>
</header>
</div>

The header component includes the following accessibility features:

  • The <header> element serves as the banner landmark, which screen readers use to identify the site header.
  • The main navigation uses a <nav> element with aria-label="Main" to distinguish it from other nav landmarks on the page.
  • The mobile menu toggle button uses aria-expanded (initially "false") and aria-controls to associate it with the menu panel. JavaScript should toggle aria-expanded to "true" when the menu opens.
  • The search toggle button includes visually hidden text (“Search”) so screen readers announce its purpose.
  • The search submit button includes visually hidden text (“Submit Search”).
  • Subnav toggle buttons use aria-labelledby to associate each submenu with its parent item.

When implementing the header, also consider:

  • Moving focus into the mobile menu when it opens and returning focus to the toggle button when it closes.
  • Implementing a focus trap within the open mobile menu so keyboard users don’t tab behind it into obscured content.
  • Adding a “Skip to main content” link as the first focusable element so keyboard users can bypass the navigation.