<nav class="nav">
<div class="nav__outer-wrap">
<div class="nav__heading">
<a class="nav__link bold" href="#">GC Admissions</a>
</div>
<ul class="nav__inner-wrap">
<li class="nav__item">
<a class="nav__link" href="#">Apply</a>
</li>
<li class="nav__item">
<a class="nav__link" href="#">Visit Campus</a>
</li>
<li class="nav__item">
<a class="nav__link" href="#">Deposit</a>
</li>
<li class="nav__item">
<a class="nav__link" href="#">Financial Aid</a>
</li>
<li class="nav__item">
<a class="nav__link" href="#">Meet Your Counselor</a>
</li>
<li class="nav__item">
<a class="nav__link" href="#">Contact Us</a>
</li>
</ul>
</div>
</nav>
@use postcss-nested;
@use postcss-simple-vars;
$purple: #8b75a6;
$gray-100: #f5f5f5;
$gray-300: #e0e0e0;
$gray-850: #323232;
$nav-height: 2.5em;
$page-max-width: 1260px;
/* reset */
html {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
box-sizing: border-box;
}
*, :after, :before {
box-sizing: inherit;
}
body {
font: 16px/1.5 Source Sans Pro, Helvetica Neue, Helvetica, Arial, sans-serif;
color: $gray-850;
}
body, ul {
margin: 0;
}
ul {
padding: 0;
}
li {
display: block;
}
a {
color: inherit;
text-decoration: none;
}
/* utility */
.bold {
font-weight: 600;
}
/* nav component */
.nav {
width: 100%;
line-height: $nav-height;
background-color: $gray-100;
border-bottom: 1px solid $gray-300;
overflow: hidden;
/* hide horizontal scrollbar */
-ms-overflow-style: none;
::-webkit-scrollbar {
width: 0;
}
/*
height maintained by placeholder.
this makes it easy to eventually make this menu fixed (if we want to do that)
*/
position: absolute;
z-index: 1;
}
.nav, .nav__placeholder {
height: $nav-height;
}
.nav__outer-wrap {
display: flex;
justify-content: space-between;
height: 65em;
width: $page-max-width;
max-width: 100%;
margin: 0 auto;
}
.nav__heading {
display: inline-block;
flex-shrink: 0;
flex-grow: 1;
height: $nav-height;
margin-right: -10em;
z-index: 2 /* so leftmost nav__item's don't cover it on scroll */
}
.nav__inner-wrap {
white-space: nowrap;
height: 65em;
display: flex;
}
.nav__item {
height: $nav-height;
flex-shrink: 0;
}
.nav__item:first-child {
margin-left: 10em;
}
.nav__link{
display: block;
padding: 0 .625em;
vertical-align: top;
&:hover, &:focus {
background-color: $purple;
color: white;
border-bottom-color: $purple;
}
}
@media only screen and (max-width:479px) {
.nav__outer-wrap {
overflow-x: auto;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
}
}
@media only screen and (min-width:480px) {
.nav__inner-wrap {
overflow-x: auto;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
}
.nav__heading {
background-color: $gray-300;
}
}
@media screen and (min-width:1024px) {
.nav__outer-wrap {
position: relative;
padding-right: 0;
}
.nav__heading {
background-color: transparent;
}
.nav__link {
padding: 0 1em;
}
}
View Compiled
This Pen doesn't use any external JavaScript resources.