Skip to content

Instantly share code, notes, and snippets.

@GarySwift
Last active May 11, 2017 09:00
Show Gist options
  • Save GarySwift/392d9c8a75ea73800c7bfc394fc9d246 to your computer and use it in GitHub Desktop.
Save GarySwift/392d9c8a75ea73800c7bfc394fc9d246 to your computer and use it in GitHub Desktop.
Use sass variables to style the Zurb Foundation 6 top-bar. This makes top-bar style a lot easier.
$darken-scale: 10%;
$topbar-color: $white;
$topbar-font-family: $body-font-family;
$topbar-font-weight: $global-weight-normal;
$topbar-bg-color: $primary-color;
$active-link-color: $topbar-color;
$active-link-bg-color: darken($topbar-bg-color, $darken-scale);// default is transparent
$active-link-hover-color: $topbar-bg-color;
$topbar-menu-border-type: none;
$topbar-menu-border-color: transparent;
$title-bg-color: $topbar-bg-color;
$topbar-height: default;
$topbar-font-size: 0.9rem;
$topbar-font-size-large: default;
$topbar-home-font-size: default;
$dropdown-color: $topbar-color;
$dropdown-bg-color: $topbar-bg-color;
$dropdown-alignment: right;
$dropdown-min-width: 200px;// Default is 200px
$drop-down-border: none;
$top-bar-case: default;
.title-bar {
background: $title-bg-color;
.title-bar-title a {
color: $topbar-color;
}
}
.top-bar {
text-transform: $top-bar-case;
background-color: $title-bg-color;
ul {
background-color: $title-bg-color;
}
.menu{
a{
font-family: $topbar-font-family;
font-weight: $topbar-font-weight;
font-size: $topbar-font-size;
height: $topbar-height;
line-height: $topbar-height;
color: $topbar-color;
padding: 0 40px;
transition: all 0.2s ease-in-out;
}
.home a {
font-size: $topbar-home-font-size;
color: $topbar-color;
}
li:not(:last-child) {
border-right: 1px $topbar-menu-border-type $topbar-menu-border-color;
}
a:hover:not(.button) {
color: $active-link-hover-color;
background-color: $topbar-color;
}
@if $topbar-height != default {
> li:not(.menu-text) > a {
padding: 0 1rem;
}
@media screen and #{breakpoint(large)} {
> li:not(.menu-text) > a {
padding: 0 1rem;
}
}
}
li.current-menu-item > a {
color: $active-link-color;
background-color: $active-link-bg-color;
}
.active > a {
color: $active-link-color;
background-color: $active-link-bg-color;
}
// Dropdown style
&.dropdown {
.submenu {
> li {
border: $drop-down-border;
border-top: none;
text-align: $dropdown-alignment;
> a {
color: $dropdown-color;
background-color: $dropdown-bg-color;
}
> a {
&:hover {
color: $dropdown-bg-color;
background-color: $dropdown-color;
}
}
}
> li.current-menu-item {
> a {
color: $active-link-color;
background-color: $active-link-bg-color;
}
> a {
&:hover {
color: $topbar-bg-color;
background-color: $topbar-color;
}
}
}
}
}
}
.is-dropdown-submenu {
min-width: $dropdown-min-width;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment