So I've created a navbar and I've got it working with horizontal navigation. However I've got these "gaps" between the navbar as they show in the picture below, however I can still click between these gaps.
Here is the JSFiddle (SCSS wouldnt work so I used the compiled CSS):
http://codepen.io/anon/pen/JRRowb
Here is the nav code I'm using, variables are just colors that I'm using:
HTML:
<nav id="nav">
<span class="brand">Brand Name</span>
<ul>
<li><a href="about.html">About <i class="fa fa-angle-down"></i></a></li>
<li><a href="portfolio.html">Portfolio</a></li>
<li><a href="contact.html">Contact Us</a></li>
</ul>
<a class="nav-bars"><i class="fa fa-bars"></i></a>
</nav>
SCSS (Sass):
/*----------------
Navbar Styles
----------------*/
.nav_fixed {
position: fixed;
top: -($info_bar_height / 4);
z-index: 100;
}
nav {
height: $navbar_height;
width: 100%;
margin: 0;
color: $navbar_color;
background: $navbar_background_color;
font-weight: bold;
letter-spacing: 0.025em;
line-height: $navbar_height;
text-transform: uppercase;
-webkit-box-shadow: 0 8px 6px -6px $navbar_shadow_color;
-moz-box-shadow: 0 8px 6px -6px $navbar_shadow_color;
box-shadow: 0 8px 6px -6px $navbar_shadow_color;
.brand {
float: left;
margin-left: $navbar_padding;
font-size: 20px;
}
ul {
margin: 0;
padding: 0;
display: flex;
float: right;
margin-right: $navbar_padding - 20px;
li {
display: inline-block;
list-style: none;
cursor: pointer;
a {
color: $navbar_color;
text-decoration: none;
padding: ($navbar_height / 4) 20px;
margin: 10px 0;
@include transition(all .175s ease-in-out);
}
a.nav-bars {
display: none;
}
}
li:hover {
a {
color: $link_hover_color;
}
}
}
a.nav-bars {
display: none;
}
}
/*--------------------
Responsive Styles
--------------------*/
@media only screen and (min-width: 320px) and (max-width: 768px) {
.info_bar {
display: none;
}
nav {
position: fixed;
z-index: 100;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
ul {
position: absolute;
top: $navbar_height + ($navbar_padding / 4) - 10px;
display: none;
height: 100%;
width: 100%;
z-index: 90;
}
a.nav-bars {
margin: 0;
padding: 0;
display: inline-block;
text-decoration: none;
float: right;
margin-right: $navbar_padding;
font-size: 24px;
cursor: pointer;
@include transition(all .375s ease-in-out);
}
li {
display: block;
width: 100%;
padding: 0;
margin: 0;
a {
position: relative;
display: block;
margin: 0;
padding: 0;
color: $navbar_color;
background: $navbar_background_color;
font-weight: bold;
letter-spacing: 0.025em;
line-height: 40px;
border-bottom: 1px solid darken($navbar_background_color, 5);
border-top: 1px solid darken($navbar_background_color, 5);
}
}
}
}
.rotate {
@include transform(rotate(90deg));
}
JS:
$(function() {
var nav = $('nav');
var info_bar_height = $('#info_bar').height();
$(window).scroll(function() {
if($(this).scrollTop() > info_bar_height) {
nav.addClass('nav_fixed');
} else {
nav.removeClass('nav_fixed');
}
});
var bars = $('.nav-bars');
var menu = $('nav ul');
var menuHeight = menu.height();
$(bars).on('click', function(e) {
e.preventDefault();
bars.toggleClass('rotate');
menu.slideToggle(375, "linear");
});
});