geostocker geostocker - 5 months ago 25
HTML Question

Bootstrap data-spy not firing off

I'm working on a profile website for myself and have a 'decent' concept up and running.

However it seems as if my navbar's data-spy either isn't firing off or if there is something wrong with my html / css.

This is a pen with the html / css.
This is the body (relevant data-spy reference):

<body data-spy="scroll" data-target="#navbar" data-offset="50">

This is how I've set up the navbar:

<nav id="navbar" class="collapse navbar-collapse">
<div class="navbar-header">

<button type="button" data-toggle="collapse" data-target="#navBar-target" class="navbar-toggle">
<span class="icon-bar"> </span>
<span class="icon-bar"> </span>
<span class="icon-bar"> </span>
<div class="collapse navbar-collapse" id="navBar-target">
<ul class="nav navbar-nav navbar-right">
<a href="#top" > About </a>
<a href="#portfolio" > Portfolio </a>
<li class>
<a href="#contact" > Contact </a>

And here is some of the relevant css:

.navbar-default .navbar-nav>li>a:focus,
.navbar-default .navbar-nav>li>a:hover {
color: #333;
background-color: black;

.navbar-nav>li>a {
color: #000000 !important;

#navbar {
margin: 12px 0;

.navbar-default .navbar-toggle {
border-color: #ddd;

.navbar-toggle {
position: relative;
float: right;
padding: 9vw 10vw
margin-top: 8vw;
margin-right: 15vw;
margin-bottom: 8vw;
background-color: transparent;
background-image: none;
border: 1vw solid transparent;
border-radius: 4vw;

.navbar-default .navbar-collapse {
border-color: #e7e7e7;

.nav>li {
height: 100%;
text-transform: uppercase;
font-weight: bold;
letter-spacing: 2px;
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;

.nav>li>a:hover {
text-decoration: none;
color: #722872;
background-color: #FFFFFF;

.nav>li a:hover {
color: #722872;
background: #FFFFFF;
box-shadow: 0px 2px 2px 1px rgba(0, 0, 0, 0.1);

As mentioned, a full working example is on the code-pen


Seems Bootstrap doesn't include a default style for the active nav element. Need to create a style for .navbar-nav>.active>a