Hero Subnav

By Rafi

F6
#
How do I use This?

A secondary navigation to switch between pages in a category.

HTML
<header class="subnav-hero-section">
  <h1 class="subnav-hero-headline">Foundation <small>by ZURB</small></h1>
  <ul class="subnav-hero-subnav">
    <li><a href="#">Take Action!</a></li>
    <li><a href="#" class="is-active">Carpe Diem!</a></li>
    <li><a target="_blank" href="https://zurb.com/responsive">Just do it!</a></li>
  </ul>
</header>

$subnav-hero-bg: $primary-color;
$subnav-hero-link-padding: 0.9rem 1rem;
$subnav-hero-font-size: 0.75rem;
$subnav-hero-link-opacity: 0.15;
$subnav-hero-height: 300px;
$subnav-hero-transition: all 0.35s ease-in-out;

.subnav-hero-section {
  text-align: center;
  background: $subnav-hero-bg;
  background-size: cover;
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  height: $subnav-hero-height;

  .subnav-hero-headline {
    color: $white;
  }
}

.subnav-hero-subnav {
  float: none;
  position: absolute;
  text-align: center;
  margin: 0 auto;
  bottom: 0;
  width: 100%;

  li {
    float: none;
    display: inline-block;

    a {
      padding: $subnav-hero-link-padding;
      font-size: $subnav-hero-font-size;
      color: $white;
      text-transform: uppercase;
      display: block;
      font-weight: bold;
      letter-spacing: 1px;
      transition: $subnav-hero-transition;

      &.is-active {
        background: rgba($white, $subnav-hero-link-opacity);
      }

      &:hover {
        background: rgba($white, $subnav-hero-link-opacity);
      }
    }
  }
}


.subnav-hero-section {
  text-align: center;
  background: #1779ba;
  background-size: cover;
  position: relative;
  overflow: visible;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
  height: 300px;
}

.subnav-hero-section .subnav-hero-headline {
  color: #fefefe;
}

.subnav-hero-subnav {
  float: none;
  position: absolute;
  text-align: center;
  margin: 0 auto;
  bottom: 0;
  width: 100%;
}

.subnav-hero-subnav li {
  float: none;
  display: inline-block;
}

.subnav-hero-subnav li a {
  padding: 0.9rem 1rem;
  font-size: 0.75rem;
  color: #fefefe;
  text-transform: uppercase;
  display: block;
  font-weight: bold;
  letter-spacing: 1px;
  transition: all 0.35s ease-in-out;
}

.subnav-hero-subnav li a.is-active {
  background: rgba(254, 254, 254, 0.15);
}

.subnav-hero-subnav li a:hover {
  background: rgba(254, 254, 254, 0.15);
}

JS