I want to add a glyphicon before my navbar items, just like in this page:
http://skywarriorthemes.com/arcane/landing/
Here is my navbar:
HTML:
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Page 1</li>
<li>Page 2</li>
<li class="navfixborder">Page 3</li>
</ul>
</div>
</div>
</nav>
full with css:
https://jsfiddle.net/Lystef91/
Check the docs!
http://getbootstrap.com/components/ gives this example:
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
Assuming you've got the icons included into your page/css already. This will depend on your setup; if you've just installed bootstrap off the shelf, I believe that includes the icons. If I've misunderstood and you're not using bootstrap, the instructions will still be roughly the same. Most icon fonts like this use classes on empty elements, and whichever one you're using will show which class goes to which icon on their demo pages.
I think you are using bootstrap. If that's the case Go to this link and add those classes just like the following.
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><i class="glyphicon glyphicon-home" style = "color : #e98fa0;"></i>Home</li>
<li><i class="glyphicon glyphicon-fire" style = "color : #e98fa0;"></i>Page 1</li>
<li><i class="glyphicon glyphicon-search" style = "color : #e98fa0;"></i>Page 2</li>
<li class="navfixborder"><i class="glyphicon glyphicon-leaf" style = "color : #e98fa0;"></i>Page 3</li>
</ul>
</div>
</div>
</nav>
I hope this helps you.
There Is 2 Way To Do This.
1 ) IN Case Of Using bootstrap Then Use Bootstrap icons Go to below Link: and Just Add Given Classes
http://getbootstrap.com/components/
NOTE: First Add below Bootstrap glyphicon cdn: LINK
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
Example With Bootstrap Glyphicon:
a{
text-decoration: none;
}
.nav {
padding-left: 0;
margin-bottom: 0;
list-style: none;
}
.nav>li {
position: relative;
display: block;
}
.nav>li>a {
position: relative;
display: block;
padding: 10px 15px;
}
.nav>li>a:hover,
.nav>li>a:focus {
text-decoration: none;
background-color: #101014;
}
.nav>li.disabled>a {
color: #777;
}
.nav>li.disabled>a:hover,
.nav>li.disabled>a:focus {
color: #777;
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
}
.nav .open>a,
.nav .open>a:hover,
.nav .open>a:focus {
background-color: #eee;
border-color: #337ab7;
}
.nav .nav-divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.nav>li>a>img {
max-width: none;
}
.nav-tabs {
border-bottom: 1px solid #ddd;
}
.nav-tabs>li {
float: left;
margin-bottom: -1px;
}
.nav-tabs>li>a {
margin-right: 2px;
line-height: 1.42857143;
border: 1px solid transparent;
}
.nav-tabs>li>a:hover {
border-color: #eee #eee #ddd;
}
.nav-tabs>li.active>a,
.nav-tabs>li.active>a:hover,
.nav-tabs>li.active>a:focus {
color: #555;
cursor: default;
background-color: #fff;
border: 1px solid #ddd;
border-bottom-color: transparent;
}
.nav-tabs.nav-justified {
width: 100%;
border-bottom: 0;
}
.nav-tabs.nav-justified>li {
float: none;
}
.nav-tabs.nav-justified>li>a {
margin-bottom: 5px;
text-align: center;
}
.nav-tabs.nav-justified>.dropdown .dropdown-menu {
top: auto;
left: auto;
}
#media (min-width: 768px) {
.nav-tabs.nav-justified>li {
display: table-cell;
width: 1%;
}
.nav-tabs.nav-justified>li>a {
margin-bottom: 0;
}
}
.nav-tabs.nav-justified>li>a {
margin-right: 0;
}
.nav-tabs.nav-justified>.active>a,
.nav-tabs.nav-justified>.active>a:hover,
.nav-tabs.nav-justified>.active>a:focus {
border: 1px solid #ddd;
}
#media (min-width: 768px) {
.nav-tabs.nav-justified>li>a {
border-bottom: 1px solid #ddd;
}
.nav-tabs.nav-justified>.active>a,
.nav-tabs.nav-justified>.active>a:hover,
.nav-tabs.nav-justified>.active>a:focus {
border-bottom-color: #fff;
}
}
.nav-pills>li {
float: left;
}
.nav-pills>li>a {
border-radius: 4px;
}
.nav-pills>li+li {
margin-left: 2px;
}
.nav-pills>li.active>a,
.nav-pills>li.active>a:hover,
.nav-pills>li.active>a:focus {
color: #fff;
background-color: #337ab7;
}
.nav-stacked>li {
float: none;
}
.nav-stacked>li+li {
margin-top: 2px;
margin-left: 0;
}
.nav-justified {
width: 100%;
}
.nav-justified>li {
float: none;
}
.nav-justified>li>a {
margin-bottom: 5px;
text-align: center;
}
.nav-justified>.dropdown .dropdown-menu {
top: auto;
left: auto;
}
#media (min-width: 768px) {
.nav-justified>li {
display: table-cell;
width: 1%;
}
.nav-justified>li>a {
margin-bottom: 0;
}
}
.nav-tabs-justified {
border-bottom: 0;
}
.nav-tabs-justified>li>a {
margin-right: 0;
border-radius: 4px;
}
.nav-tabs-justified>.active>a,
.nav-tabs-justified>.active>a:hover,
.nav-tabs-justified>.active>a:focus {
border: 1px solid #ddd;
}
#media (min-width: 768px) {
.nav-tabs-justified>li>a {
border-bottom: 1px solid #ddd;
border-radius: 4px 4px 0 0;
}
.nav-tabs-justified>.active>a,
.nav-tabs-justified>.active>a:hover,
.nav-tabs-justified>.active>a:focus {
border-bottom-color: #fff;
}
}
.tab-content>.tab-pane {
display: none;
}
.tab-content>.active {
display: block;
}
.nav-tabs .dropdown-menu {
margin-top: -1px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.navbar {
position: relative;
min-height: 50px;
margin-bottom: 20px;
border: 1px solid transparent;
}
#media (min-width: 768px) {
.navbar {
border-radius: 0px;
}
}
#media (min-width: 768px) {
.navbar-header {
float: left;
}
}
.navbar-collapse {
padding-right: 15px;
padding-left: 15px;
overflow-x: visible;
-webkit-overflow-scrolling: touch;
border-top: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
.navbar-collapse.in {
overflow-y: auto;
}
#media (min-width: 768px) {
.navbar-collapse {
width: auto;
border-top: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.navbar-collapse.collapse {
display: block !important;
height: auto !important;
padding-bottom: 0;
overflow: visible !important;
}
.navbar-collapse.in {
overflow-y: visible;
}
.navbar-fixed-top .navbar-collapse,
.navbar-static-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
padding-right: 0;
padding-left: 0;
}
}
.navbar-fixed-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
max-height: 340px;
}
#media (max-device-width: 480px) and (orientation: landscape) {
.navbar-fixed-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
max-height: 200px;
}
}
.container>.navbar-header,
.container-fluid>.navbar-header,
.container>.navbar-collapse,
.container-fluid>.navbar-collapse {
margin-right: -15px;
margin-left: -15px;
}
#media (min-width: 768px) {
.container>.navbar-header,
.container-fluid>.navbar-header,
.container>.navbar-collapse,
.container-fluid>.navbar-collapse {
margin-right: 0;
margin-left: 0;
}
}
.navbar-static-top {
z-index: 1000;
border-width: 0 0 1px;
}
#media (min-width: 768px) {
.navbar-static-top {
border-radius: 0;
}
}
.navbar-fixed-top,
.navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
}
#media (min-width: 768px) {
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-fixed-bottom {
bottom: 0;
margin-bottom: 0;
border-width: 1px 0 0;
}
.navbar-brand {
float: left;
height: 50px;
padding: 15px 15px;
font-size: 18px;
line-height: 20px;
}
.navbar-brand:hover,
.navbar-brand:focus {
text-decoration: none;
}
.navbar-brand>img {
display: block;
}
#media (min-width: 768px) {
.navbar>.container .navbar-brand,
.navbar>.container-fluid .navbar-brand {
margin-left: -15px;
}
}
.navbar-toggle {
position: relative;
float: right;
padding: 9px 10px;
margin-top: 8px;
margin-right: 15px;
margin-bottom: 8px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.navbar-toggle:focus {
outline: 0;
}
.navbar-toggle .icon-bar {
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
}
.navbar-toggle .icon-bar+.icon-bar {
margin-top: 4px;
}
#media (min-width: 768px) {
.navbar-toggle {
display: none;
}
}
.navbar-nav {
margin: 7.5px -15px;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
line-height: 20px;
}
#media (max-width: 767px) {
.navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.navbar-nav .open .dropdown-menu>li>a,
.navbar-nav .open .dropdown-menu .dropdown-header {
padding: 5px 15px 5px 25px;
}
.navbar-nav .open .dropdown-menu>li>a {
line-height: 20px;
}
.navbar-nav .open .dropdown-menu>li>a:hover,
.navbar-nav .open .dropdown-menu>li>a:focus {
background-image: none;
}
}
#media (min-width: 768px) {
.navbar-nav {
margin: 0;
text-align: center;
font-size: .9em;
width: 100%;
font-weight: bold;
text-transform: uppercase;
font-family: Roboto, 'Open Sans', Arial;
}
.navbar-nav>li {
float: none;
display: inline-block;
margin-left: -5px;
border-left: 2px solid #333240;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
padding-right: 45px;
padding-left: 45px;
}
}
.navbar-form {
padding: 10px 15px;
margin-top: 8px;
margin-right: -15px;
margin-bottom: 8px;
margin-left: -15px;
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);
}
#media (min-width: 768px) {
.navbar-form .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .form-control {
display: inline-block;
width: auto;
vertical-align: middle;
}
.navbar-form .form-control-static {
display: inline-block;
}
.navbar-form .input-group {
display: inline-table;
vertical-align: middle;
}
.navbar-form .input-group .input-group-addon,
.navbar-form .input-group .input-group-btn,
.navbar-form .input-group .form-control {
width: auto;
}
.navbar-form .input-group>.form-control {
width: 100%;
}
.navbar-form .control-label {
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .radio,
.navbar-form .checkbox {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .radio label,
.navbar-form .checkbox label {
padding-left: 0;
}
.navbar-form .radio input[type="radio"],
.navbar-form .checkbox input[type="checkbox"] {
position: relative;
margin-left: 0;
}
.navbar-form .has-feedback .form-control-feedback {
top: 0;
}
}
#media (max-width: 767px) {
.navbar-form .form-group {
margin-bottom: 5px;
}
.navbar-form .form-group:last-child {
margin-bottom: 0;
}
}
#media (min-width: 768px) {
.navbar-form {
width: auto;
padding-top: 0;
padding-bottom: 0;
margin-right: 0;
margin-left: 0;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
}
.navbar-nav>li>.dropdown-menu {
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu {
margin-bottom: 0;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.navbar-btn {
margin-top: 8px;
margin-bottom: 8px;
}
.navbar-btn.btn-sm {
margin-top: 10px;
margin-bottom: 10px;
}
.navbar-btn.btn-xs {
margin-top: 14px;
margin-bottom: 14px;
}
.navbar-text {
margin-top: 15px;
margin-bottom: 15px;
}
#media (min-width: 768px) {
.navbar-text {
float: left;
margin-right: 15px;
margin-left: 15px;
}
}
#media (min-width: 768px) {
.navbar-left {
float: left !important;
}
.navbar-right {
float: right !important;
margin-right: -15px;
}
.navbar-right~.navbar-right {
margin-right: 0;
}
}
.navbar-default {
background-color: #f8f8f8;
border-color: #e7e7e7;
}
.navbar-default .navbar-brand {
color: #777;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #5e5e5e;
background-color: transparent;
}
.navbar-default .navbar-text {
color: #777;
}
.navbar-default .navbar-nav>li>a {
color: #777;
}
.navbar-default .navbar-nav>li>a:hover,
.navbar-default .navbar-nav>li>a:focus {
color: #333;
background-color: transparent;
}
.navbar-default .navbar-nav>.active>a,
.navbar-default .navbar-nav>.active>a:hover,
.navbar-default .navbar-nav>.active>a:focus {
color: #555;
background-color: #e7e7e7;
}
.navbar-default .navbar-nav>.disabled>a,
.navbar-default .navbar-nav>.disabled>a:hover,
.navbar-default .navbar-nav>.disabled>a:focus {
color: #ccc;
background-color: transparent;
}
.navbar-default .navbar-toggle {
border-color: #ddd;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #ddd;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #888;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #e7e7e7;
}
.navbar-default .navbar-nav>.open>a,
.navbar-default .navbar-nav>.open>a:hover,
.navbar-default .navbar-nav>.open>a:focus {
color: #555;
background-color: #e7e7e7;
}
#media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu>li>a {
color: #777;
}
.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,
.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus {
color: #333;
background-color: transparent;
}
.navbar-default .navbar-nav .open .dropdown-menu>.active>a,
.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,
.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus {
color: #555;
background-color: #e7e7e7;
}
.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,
.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,
.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus {
color: #ccc;
background-color: transparent;
}
}
.navbar-default .navbar-link {
color: #777;
}
.navbar-default .navbar-link:hover {
color: #333;
}
.navbar-default .btn-link {
color: #777;
}
.navbar-default .btn-link:hover,
.navbar-default .btn-link:focus {
color: #333;
}
.navbar-default .btn-link[disabled]:hover,
fieldset[disabled] .navbar-default .btn-link:hover,
.navbar-default .btn-link[disabled]:focus,
fieldset[disabled] .navbar-default .btn-link:focus {
color: #ccc;
}
.navbar-inverse {
background-color: #2a2a34;
border: 2px solid #3b3a4a;
}
.navbar-inverse .navbar-brand {
color: #9d9d9d;
}
.navbar-inverse .navbar-brand:hover,
.navbar-inverse .navbar-brand:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-text {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav>li>a {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav>li>a:hover,
.navbar-inverse .navbar-nav>li>a:focus {
color: #fff;
background-color: #212129;
}
.navbar-inverse .navbar-nav>.active>a,
.navbar-inverse .navbar-nav>.active>a:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-nav>.active>a:hover {
background-color: #212129;
}
.navbar-inverse .navbar-nav>.disabled>a,
.navbar-inverse .navbar-nav>.disabled>a:hover,
.navbar-inverse .navbar-nav>.disabled>a:focus {
color: #444;
background-color: transparent;
}
.navbar-inverse .navbar-toggle {
border-color: #333;
}
.navbar-inverse .navbar-toggle:hover,
.navbar-inverse .navbar-toggle:focus {
background-color: #333;
}
.navbar-inverse .navbar-toggle .icon-bar {
background-color: #fff;
}
.navbar-inverse .navbar-collapse,
.navbar-inverse .navbar-form {
border-color: #101010;
}
.navbar-inverse .navbar-nav>.open>a,
.navbar-inverse .navbar-nav>.open>a:hover,
.navbar-inverse .navbar-nav>.open>a:focus {
color: #fff;
background-color: #3b3a4a;
}
#media (max-width: 767px) {
.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header {
border-color: #3b3a4a;
}
.navbar-inverse .navbar-nav .open .dropdown-menu .divider {
background-color: #3b3a4a;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,
.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus {
color: #fff;
background-color: #3b3a4a;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,
.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus {
color: #444;
background-color: transparent;
}
}
.navbar-inverse .navbar-link {
color: #9d9d9d;
}
.navbar-inverse .navbar-link:hover {
color: #fff;
}
.navbar-inverse .btn-link {
color: #9d9d9d;
}
.navbar-inverse .btn-link:hover,
.navbar-inverse .btn-link:focus {
color: #fff;
}
.navbar-inverse .btn-link[disabled]:hover,
fieldset[disabled] .navbar-inverse .btn-link:hover,
.navbar-inverse .btn-link[disabled]:focus,
fieldset[disabled] .navbar-inverse .btn-link:focus {
color: #444;
}
.navfixborder {
border-right: 2px solid #333240;
}
.navbar {
min-height: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><i class="glyphicon glyphicon-home" aria-hidden="true"></i> HOMEPAGE</li>
<li><i class="glyphicon glyphicon-cd"></i> TEAM WARS</li>
<li><i class="glyphicon glyphicon-paperclip"></i> GAMING NEWS</li>
<li class="navfixborder"><i class="glyphicon glyphicon-star"> </i> FORUMS</li>
<li><i class="glyphicon glyphicon-cd"></i> SHOP</li>
<li><i class="glyphicon glyphicon-star"></i> BLOG</li>
<li><i class="glyphicon glyphicon-user"></i> CONTACT</li>
</ul>
</div>
</div>
</nav>
2) IN Case Of Using font Awesome Then Go to below Link:
http://fontawesome.io/icons/
NOTE: First Add below Font Awesome Library and See The Example of Used:
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
Example with FontAwesome:
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><i class="fa fa-home fa-sm" aria-hidden="true"></i> HOMEPAGE</li>
<li><i class="fa fa fa-trophy fa-sm"></i> TEAM WARS</li>
<li><i class="fa fa-bullseye fa-sm"></i> GAMING NEWS</li>
<li class="navfixborder"><i class="fa fa-users fa-sm"> </i> FORUMS</li>
<li><i class="fa fa-shopping-cart fa-sm"></i> SHOP</li>
<li><i class="fa fa-book fa-sm"></i> BLOG</li>
<li><i class="fa fa-envelope fa-sm"></i> CONTACT</li>
</ul>
</div>
</div>
</nav>
Simple example for you (using font font-awesome/4.7.0).
Just two step to use it:
1st reference the font-awesome lib:
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
2nd add to each of your menu item like:
<li class="active"><i class="fa fa-home fa-lg" aria-hidden="true"></i> Home</li>
.nav {
padding-left: 0;
margin-bottom: 0;
list-style: none;
}
.nav>li {
position: relative;
display: block;
}
.nav>li>a {
position: relative;
display: block;
padding: 10px 15px;
}
.nav>li>a:hover,
.nav>li>a:focus {
text-decoration: none;
background-color: #101014;
}
.nav>li.disabled>a {
color: #777;
}
.nav>li.disabled>a:hover,
.nav>li.disabled>a:focus {
color: #777;
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
}
.nav .open>a,
.nav .open>a:hover,
.nav .open>a:focus {
background-color: #eee;
border-color: #337ab7;
}
.nav .nav-divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.nav>li>a>img {
max-width: none;
}
.nav-tabs {
border-bottom: 1px solid #ddd;
}
.nav-tabs>li {
float: left;
margin-bottom: -1px;
}
.nav-tabs>li>a {
margin-right: 2px;
line-height: 1.42857143;
border: 1px solid transparent;
}
.nav-tabs>li>a:hover {
border-color: #eee #eee #ddd;
}
.nav-tabs>li.active>a,
.nav-tabs>li.active>a:hover,
.nav-tabs>li.active>a:focus {
color: #555;
cursor: default;
background-color: #fff;
border: 1px solid #ddd;
border-bottom-color: transparent;
}
.nav-tabs.nav-justified {
width: 100%;
border-bottom: 0;
}
.nav-tabs.nav-justified>li {
float: none;
}
.nav-tabs.nav-justified>li>a {
margin-bottom: 5px;
text-align: center;
}
.nav-tabs.nav-justified>.dropdown .dropdown-menu {
top: auto;
left: auto;
}
#media (min-width: 768px) {
.nav-tabs.nav-justified>li {
display: table-cell;
width: 1%;
}
.nav-tabs.nav-justified>li>a {
margin-bottom: 0;
}
}
.nav-tabs.nav-justified>li>a {
margin-right: 0;
}
.nav-tabs.nav-justified>.active>a,
.nav-tabs.nav-justified>.active>a:hover,
.nav-tabs.nav-justified>.active>a:focus {
border: 1px solid #ddd;
}
#media (min-width: 768px) {
.nav-tabs.nav-justified>li>a {
border-bottom: 1px solid #ddd;
}
.nav-tabs.nav-justified>.active>a,
.nav-tabs.nav-justified>.active>a:hover,
.nav-tabs.nav-justified>.active>a:focus {
border-bottom-color: #fff;
}
}
.nav-pills>li {
float: left;
}
.nav-pills>li>a {
border-radius: 4px;
}
.nav-pills>li+li {
margin-left: 2px;
}
.nav-pills>li.active>a,
.nav-pills>li.active>a:hover,
.nav-pills>li.active>a:focus {
color: #fff;
background-color: #337ab7;
}
.nav-stacked>li {
float: none;
}
.nav-stacked>li+li {
margin-top: 2px;
margin-left: 0;
}
.nav-justified {
width: 100%;
}
.nav-justified>li {
float: none;
}
.nav-justified>li>a {
margin-bottom: 5px;
text-align: center;
}
.nav-justified>.dropdown .dropdown-menu {
top: auto;
left: auto;
}
#media (min-width: 768px) {
.nav-justified>li {
display: table-cell;
width: 1%;
}
.nav-justified>li>a {
margin-bottom: 0;
}
}
.nav-tabs-justified {
border-bottom: 0;
}
.nav-tabs-justified>li>a {
margin-right: 0;
border-radius: 4px;
}
.nav-tabs-justified>.active>a,
.nav-tabs-justified>.active>a:hover,
.nav-tabs-justified>.active>a:focus {
border: 1px solid #ddd;
}
#media (min-width: 768px) {
.nav-tabs-justified>li>a {
border-bottom: 1px solid #ddd;
border-radius: 4px 4px 0 0;
}
.nav-tabs-justified>.active>a,
.nav-tabs-justified>.active>a:hover,
.nav-tabs-justified>.active>a:focus {
border-bottom-color: #fff;
}
}
.tab-content>.tab-pane {
display: none;
}
.tab-content>.active {
display: block;
}
.nav-tabs .dropdown-menu {
margin-top: -1px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.navbar {
position: relative;
min-height: 50px;
margin-bottom: 20px;
border: 1px solid transparent;
}
#media (min-width: 768px) {
.navbar {
border-radius: 0px;
}
}
#media (min-width: 768px) {
.navbar-header {
float: left;
}
}
.navbar-collapse {
padding-right: 15px;
padding-left: 15px;
overflow-x: visible;
-webkit-overflow-scrolling: touch;
border-top: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
.navbar-collapse.in {
overflow-y: auto;
}
#media (min-width: 768px) {
.navbar-collapse {
width: auto;
border-top: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.navbar-collapse.collapse {
display: block !important;
height: auto !important;
padding-bottom: 0;
overflow: visible !important;
}
.navbar-collapse.in {
overflow-y: visible;
}
.navbar-fixed-top .navbar-collapse,
.navbar-static-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
padding-right: 0;
padding-left: 0;
}
}
.navbar-fixed-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
max-height: 340px;
}
#media (max-device-width: 480px) and (orientation: landscape) {
.navbar-fixed-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
max-height: 200px;
}
}
.container>.navbar-header,
.container-fluid>.navbar-header,
.container>.navbar-collapse,
.container-fluid>.navbar-collapse {
margin-right: -15px;
margin-left: -15px;
}
#media (min-width: 768px) {
.container>.navbar-header,
.container-fluid>.navbar-header,
.container>.navbar-collapse,
.container-fluid>.navbar-collapse {
margin-right: 0;
margin-left: 0;
}
}
.navbar-static-top {
z-index: 1000;
border-width: 0 0 1px;
}
#media (min-width: 768px) {
.navbar-static-top {
border-radius: 0;
}
}
.navbar-fixed-top,
.navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
}
#media (min-width: 768px) {
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-fixed-bottom {
bottom: 0;
margin-bottom: 0;
border-width: 1px 0 0;
}
.navbar-brand {
float: left;
height: 50px;
padding: 15px 15px;
font-size: 18px;
line-height: 20px;
}
.navbar-brand:hover,
.navbar-brand:focus {
text-decoration: none;
}
.navbar-brand>img {
display: block;
}
#media (min-width: 768px) {
.navbar>.container .navbar-brand,
.navbar>.container-fluid .navbar-brand {
margin-left: -15px;
}
}
.navbar-toggle {
position: relative;
float: right;
padding: 9px 10px;
margin-top: 8px;
margin-right: 15px;
margin-bottom: 8px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.navbar-toggle:focus {
outline: 0;
}
.navbar-toggle .icon-bar {
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
}
.navbar-toggle .icon-bar+.icon-bar {
margin-top: 4px;
}
#media (min-width: 768px) {
.navbar-toggle {
display: none;
}
}
.navbar-nav {
margin: 7.5px -15px;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
line-height: 20px;
}
#media (max-width: 767px) {
.navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.navbar-nav .open .dropdown-menu>li>a,
.navbar-nav .open .dropdown-menu .dropdown-header {
padding: 5px 15px 5px 25px;
}
.navbar-nav .open .dropdown-menu>li>a {
line-height: 20px;
}
.navbar-nav .open .dropdown-menu>li>a:hover,
.navbar-nav .open .dropdown-menu>li>a:focus {
background-image: none;
}
}
#media (min-width: 768px) {
.navbar-nav {
margin: 0;
text-align: center;
font-size: .9em;
width: 100%;
font-weight: bold;
text-transform: uppercase;
font-family: Roboto, 'Open Sans', Arial;
}
.navbar-nav>li {
float: none;
display: inline-block;
margin-left: -5px;
border-left: 2px solid #333240;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
padding-right: 45px;
padding-left: 45px;
}
}
.navbar-form {
padding: 10px 15px;
margin-top: 8px;
margin-right: -15px;
margin-bottom: 8px;
margin-left: -15px;
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);
}
#media (min-width: 768px) {
.navbar-form .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .form-control {
display: inline-block;
width: auto;
vertical-align: middle;
}
.navbar-form .form-control-static {
display: inline-block;
}
.navbar-form .input-group {
display: inline-table;
vertical-align: middle;
}
.navbar-form .input-group .input-group-addon,
.navbar-form .input-group .input-group-btn,
.navbar-form .input-group .form-control {
width: auto;
}
.navbar-form .input-group>.form-control {
width: 100%;
}
.navbar-form .control-label {
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .radio,
.navbar-form .checkbox {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .radio label,
.navbar-form .checkbox label {
padding-left: 0;
}
.navbar-form .radio input[type="radio"],
.navbar-form .checkbox input[type="checkbox"] {
position: relative;
margin-left: 0;
}
.navbar-form .has-feedback .form-control-feedback {
top: 0;
}
}
#media (max-width: 767px) {
.navbar-form .form-group {
margin-bottom: 5px;
}
.navbar-form .form-group:last-child {
margin-bottom: 0;
}
}
#media (min-width: 768px) {
.navbar-form {
width: auto;
padding-top: 0;
padding-bottom: 0;
margin-right: 0;
margin-left: 0;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
}
.navbar-nav>li>.dropdown-menu {
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu {
margin-bottom: 0;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.navbar-btn {
margin-top: 8px;
margin-bottom: 8px;
}
.navbar-btn.btn-sm {
margin-top: 10px;
margin-bottom: 10px;
}
.navbar-btn.btn-xs {
margin-top: 14px;
margin-bottom: 14px;
}
.navbar-text {
margin-top: 15px;
margin-bottom: 15px;
}
#media (min-width: 768px) {
.navbar-text {
float: left;
margin-right: 15px;
margin-left: 15px;
}
}
#media (min-width: 768px) {
.navbar-left {
float: left !important;
}
.navbar-right {
float: right !important;
margin-right: -15px;
}
.navbar-right~.navbar-right {
margin-right: 0;
}
}
.navbar-default {
background-color: #f8f8f8;
border-color: #e7e7e7;
}
.navbar-default .navbar-brand {
color: #777;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #5e5e5e;
background-color: transparent;
}
.navbar-default .navbar-text {
color: #777;
}
.navbar-default .navbar-nav>li>a {
color: #777;
}
.navbar-default .navbar-nav>li>a:hover,
.navbar-default .navbar-nav>li>a:focus {
color: #333;
background-color: transparent;
}
.navbar-default .navbar-nav>.active>a,
.navbar-default .navbar-nav>.active>a:hover,
.navbar-default .navbar-nav>.active>a:focus {
color: #555;
background-color: #e7e7e7;
}
.navbar-default .navbar-nav>.disabled>a,
.navbar-default .navbar-nav>.disabled>a:hover,
.navbar-default .navbar-nav>.disabled>a:focus {
color: #ccc;
background-color: transparent;
}
.navbar-default .navbar-toggle {
border-color: #ddd;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #ddd;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #888;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #e7e7e7;
}
.navbar-default .navbar-nav>.open>a,
.navbar-default .navbar-nav>.open>a:hover,
.navbar-default .navbar-nav>.open>a:focus {
color: #555;
background-color: #e7e7e7;
}
#media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu>li>a {
color: #777;
}
.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,
.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus {
color: #333;
background-color: transparent;
}
.navbar-default .navbar-nav .open .dropdown-menu>.active>a,
.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,
.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus {
color: #555;
background-color: #e7e7e7;
}
.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,
.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,
.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus {
color: #ccc;
background-color: transparent;
}
}
.navbar-default .navbar-link {
color: #777;
}
.navbar-default .navbar-link:hover {
color: #333;
}
.navbar-default .btn-link {
color: #777;
}
.navbar-default .btn-link:hover,
.navbar-default .btn-link:focus {
color: #333;
}
.navbar-default .btn-link[disabled]:hover,
fieldset[disabled] .navbar-default .btn-link:hover,
.navbar-default .btn-link[disabled]:focus,
fieldset[disabled] .navbar-default .btn-link:focus {
color: #ccc;
}
.navbar-inverse {
background-color: #2a2a34;
border: 2px solid #3b3a4a;
}
.navbar-inverse .navbar-brand {
color: #9d9d9d;
}
.navbar-inverse .navbar-brand:hover,
.navbar-inverse .navbar-brand:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-text {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav>li>a {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav>li>a:hover,
.navbar-inverse .navbar-nav>li>a:focus {
color: #fff;
background-color: #212129;
}
.navbar-inverse .navbar-nav>.active>a,
.navbar-inverse .navbar-nav>.active>a:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-nav>.active>a:hover {
background-color: #212129;
}
.navbar-inverse .navbar-nav>.disabled>a,
.navbar-inverse .navbar-nav>.disabled>a:hover,
.navbar-inverse .navbar-nav>.disabled>a:focus {
color: #444;
background-color: transparent;
}
.navbar-inverse .navbar-toggle {
border-color: #333;
}
.navbar-inverse .navbar-toggle:hover,
.navbar-inverse .navbar-toggle:focus {
background-color: #333;
}
.navbar-inverse .navbar-toggle .icon-bar {
background-color: #fff;
}
.navbar-inverse .navbar-collapse,
.navbar-inverse .navbar-form {
border-color: #101010;
}
.navbar-inverse .navbar-nav>.open>a,
.navbar-inverse .navbar-nav>.open>a:hover,
.navbar-inverse .navbar-nav>.open>a:focus {
color: #fff;
background-color: #3b3a4a;
}
#media (max-width: 767px) {
.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header {
border-color: #3b3a4a;
}
.navbar-inverse .navbar-nav .open .dropdown-menu .divider {
background-color: #3b3a4a;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,
.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus {
color: #fff;
background-color: #3b3a4a;
}
.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,
.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus {
color: #444;
background-color: transparent;
}
}
.navbar-inverse .navbar-link {
color: #9d9d9d;
}
.navbar-inverse .navbar-link:hover {
color: #fff;
}
.navbar-inverse .btn-link {
color: #9d9d9d;
}
.navbar-inverse .btn-link:hover,
.navbar-inverse .btn-link:focus {
color: #fff;
}
.navbar-inverse .btn-link[disabled]:hover,
fieldset[disabled] .navbar-inverse .btn-link:hover,
.navbar-inverse .btn-link[disabled]:focus,
fieldset[disabled] .navbar-inverse .btn-link:focus {
color: #444;
}
.navfixborder {
border-right: 2px solid #333240;
}
.navbar {
min-height: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><i class="fa fa-home fa-lg" aria-hidden="true"></i> Home</li>
<li><i class="fa fa-camera-retro fa-lg"></i> Page 1</li>
<li>Page 2</li>
<li class="navfixborder">Page 3</li>
</ul>
</div>
</div>
</nav>
I would like my navbar dropdown menu to take up the entire browsing area with the list items centered, and have a brief animation during the transition.
For the animation, I want the .icon-bar hamburger menu to transition to an "X" and for the dropdown menu to have a cubic-bezier transition.
However, the list items first appear aligned left prior to the animation.
Wondering why the list is left-aligned prior to animation.
html, body {
height: 100%;
margin: 0;
padding: 0;
font-family: 'Quicksand', sans-serif;
}
body {
margin-top: 60px;
}
#main-wrapper {
display: flex;
flex-direction: column;
min-height: 100%;
}
.container {
margin: 0 auto;
}
.article {
flex: 1;
}
/*START Shrinks the default navbar height*/
.navbar {
//min-height: 30px;
margin: 0px;
width: 100%;
background-color: #444;
//height: 44px;
}
.navbar-nav > li,
.navbar-nav > li > a,
.navbar-nav > li > a:link,
.navbar-nav > li > a:visited {
padding: 4px 5px 0px 5px;
//height: 30px;
color: white;
font-size: 1.1em;
font-weight: 300;
margin: 2px 8px 0 0;
}
/*END*/
.nav.navbar-nav li a:focus,
.nav.navbar-nav li a:active,
.nav.navbar-nav li a:hover {
color: white;
opacity: 0.8;
}
.navbar-toggle {
float: left;
border: none;
margin-top: 10px;
margin-left: 10px;
padding: 4px;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:active,
.navbar-default .navbar-toggle:focus {
background-color: #444;
}
/*Displays navbar dropdown on hover */
ul.nav li.dropdown:hover ul.dropdown-menu {
display: block;
}
.navbar-default .navbar-header .icon-bar {
background-color: white;
width: 22px;
}
.navbar-default .navbar-toggle:hover .icon-bar {
background-color: #EFEFEF;
}
.navbar .navbar-brand {
color: white;
margin: -4px 20px -3px 0;
font-size: 1.7em;
font-family: 'Orbitron', 'Dosis', sans-serif;
}
.navbar .navbar-brand:focus,
.navbar .navbar-brand:hover {
color: white;
opacity: 0.8;
}
.fa-caret-down {
height: 30px;
color: lightGray;
}
/*Change hamburger menu to "x" on click */
.navbar-toggle .icon-bar {
width: 22px;
transition: all 0.4s;
}
.navbar-toggle .top-bar {
transform: rotate(405deg);
transform-origin: 10% 10%;
}
.navbar-toggle .middle-bar {
opacity: 0;
}
.navbar-toggle .bottom-bar {
transform: rotate(-405deg);
transform-origin: 10% 90%;
}
.navbar-toggle.collapsed .top-bar {
transform: rotate(0);
}
.navbar-toggle.collapsed .middle-bar {
opacity: 1;
}
.navbar-toggle.collapsed .bottom-bar {
transform: rotate(0);
}
.navbar.navbar-default .navbar-collapse {
border: none;
box-shadow: none;
}
/*Change Background color of toggle dropdown*/
.collapse.navbar-collapse {
background-color: #444;
min-width: 100%;
min-height: 100%;
}
h3 + p {
line-height: 1.8em;
}
footer {
background-color: #444;
color: white;
height: 250px;
padding: 8px;
}
footer a,
footer a:link,
footer a:visited {
color: white;
text-decoration: none;
}
footer a:hover,
footer a:active,
footer a:focus {
opacity: 0.8;
}
.tagline {
text-align: center;
}
.footer-sub {
border: thin white solid;
margin: 0 2px 7px 0;
max-width: 220px;
}
.fa-plus {
margin-top: 3px;
float: right;
}
.fa-plus:hover {
opacity: 0.8;
cursor: pointer;
}
#location-detail {
display: none;
}
a#location:focus + #location-detail {
display: block;
}
#media (max-width: 992px) {
.navbar-nav > li,
.navbar-nav > li > a,
.navbar-nav > li > a:link,
.navbar-nav > li > a:visited,
.navbar-nav > li > a:hover {
font-size: 1.05em;
}
}
#media (max-width: 767px) {
.navbar .navbar-brand {
position: absolute;
left: 50%;
margin-left: -110px !important;
display: block;
}
.collapse.navbar-collapse {
background-color: #444;
position: fixed;
min-width: 100%;
min-height: 100%;
font-size: 1.3em;
text-align: center;
padding-top: 20px;
transition-property: all;
transition-duration: 0.5s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
}
.collapse.navbar-collapse li {
margin-bottom: 15px;
}
}
<div id="main-wrapper">
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar top-bar"></span>
<span class="icon-bar middle-bar"></span>
<span class="icon-bar bottom-bar"></span>
</button>
<!--<img class="logo" src="../images/eclipse-new.png"/> -->
Eclipse Music
</div> <!-- end of navbar-header -->
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<!--<li><span class="glyphicon glyphicon-home"></span>Home</li>-->
<li>Effects</li>
<li>Guitar</li>
<li>Bass</li>
<li>Amps</li>
<li>Lessons</li>
<li class="dropdown">
About<!-- <i class="fa fa-caret-down"></i>-->
<ul class="dropdown-menu">
<li>Directions</li>
<li>Contact Us</li>
<li>Blog</li>
</ul>
</li>
</ul>
</div> <!-- end of collapse navbar-collapse -->
</div> <!-- end of container -->
</div> <!-- end of navbar navbar-default navbar-fixed-top -->
<div class="article">
<div class="container">
<h2>
Welcome!
</h2>
<br />
</div>
</div> <!-- END of article -->
<footer>
</footer> <!-- END of footer -->
</div> <!-- END of main-wrapper -->
Just add this css in your media query for Xs :
#media (max-width: 767px) {
.navbar .navbar-brand {
position: absolute;
left: 50%;
margin-left: -110px !important;
display: block;
}
.navbar-collapse {
text-align: center;
}
.navbar-collapse li{display:none}
.collapse.navbar-collapse {
background-color: #444;
position: fixed;
min-width: 100%;
min-height: 100%;
font-size: 1.3em;
padding-top: 20px;
transition-property: all;
transition-duration: 0.5s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
}
.collapse.navbar-collapse li {
display:block;
margin-bottom: 15px;
}
}
Here is a bootply with this change : http://www.bootply.com/BQGSpd2kLt
I could be wrong, but it might be this:
.navbar-toggle {
float: left;
border: none;
margin-top: 10px;
margin-left: 10px;
padding: 4px;}
May want those to be something more like this:
.navbar-toggle {
float: right;
border: none;
position: relative;
left: -50%; //or right 50%
text-align: left;
padding: 4px;}
I like the look of a smaller-than-normal navbar height, as it seems to be a popular design trend.
However, this seems to be causing issues when opening a collapse menu.
Here you can see the stages of expanding the collapse navbar-collapse menu. First is my normal navbar with a minimum height of 30px. Then when I click the toggle button, the navbar briefly expands to what appears to be 50px, and finally the full screen menu appears.
This alone isn't a big deal (though I would prefer a smooth transition), however the expand and collapse animations of the menu don't seem to behave as expected with a decreased navbar height.
Any ideas why this is happening? Or, is there something else in my styling that has nothing to do with the navbar height yet is causing the issue?
html, body {
height: 100%;
margin: 0;
padding: 0;
font-family: 'Quicksand', sans-serif;
}
body {
margin-top: 60px;
}
#main-wrapper {
display: flex;
flex-direction: column;
min-height: 100%;
}
.container {
margin: 0 auto;
}
.article {
flex: 1;
}
/*START Shrinks the default navbar height*/
.navbar {
min-height: 30px;
//max-height: 40px;
margin: 0px;
width: 100%;
background-color: #444;
}
.navbar-nav > li,
.navbar-nav > li > a,
.navbar-nav > li > a:link,
.navbar-nav > li > a:visited {
padding: 4px 5px 0px 5px;
//height: 30px;
color: white;
font-size: 1.1em;
font-weight: 300;
margin: 2px 8px 0 0;
}
/*END*/
.nav.navbar-nav li a:focus,
.nav.navbar-nav li a:active,
.nav.navbar-nav li a:hover {
color: white;
opacity: 0.8;
}
.navbar-toggle {
float: left;
border: none;
margin-top: 10px;
margin-left: 10px;
padding: 4px;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:active,
.navbar-default .navbar-toggle:focus {
background-color: #444;
}
/*Displays navbar dropdown on hover */
ul.nav li.dropdown:hover ul.dropdown-menu {
display: block;
}
.navbar-default .navbar-header .icon-bar {
background-color: white;
width: 22px;
}
.navbar-default .navbar-toggle:hover .icon-bar {
background-color: #EFEFEF;
}
.navbar .navbar-brand {
color: white;
margin: -4px 20px -3px 0;
font-size: 1.7em;
font-family: 'Orbitron', 'Dosis', sans-serif;
}
.navbar .navbar-brand:focus,
.navbar .navbar-brand:hover {
color: white;
opacity: 0.8;
}
/*Change hamburger menu to "x" on click */
.navbar-toggle .icon-bar {
width: 22px;
transition: all 0.4s;
}
.navbar-toggle .top-bar {
transform: rotate(45deg);
transform-origin: 10% 10%;
}
.navbar-toggle .middle-bar {
opacity: 0;
}
.navbar-toggle .bottom-bar {
transform: rotate(-45deg);
transform-origin: 10% 90%;
}
.navbar-toggle.collapsed .top-bar {
transform: rotate(0);
}
.navbar-toggle.collapsed .middle-bar {
opacity: 1;
}
.navbar-toggle.collapsed .bottom-bar {
transform: rotate(0);
}
.navbar.navbar-default .navbar-collapse {
border: none;
box-shadow: none;
}
/*Change Background color of toggle dropdown*/
.collapse.navbar-collapse {
background-color: #444;
min-width: 100%;
min-height: 100%;
}
h3 + p {
line-height: 1.8em;
}
footer {
background-color: #444;
color: white;
height: 250px;
padding: 8px;
min-width: 100%;
margin: 0 auto;
}
footer a,
footer a:link,
footer a:visited {
color: white;
text-decoration: none;
}
footer a:hover,
footer a:active,
footer a:focus {
opacity: 0.8;
}
.tagline {
text-align: center;
}
.footer-sub {
border: thin white solid;
margin: 0 2px 7px 0;
float: left;
width: 200px;
padding: 5px;
}
.fa-plus {
margin-top: 3px;
float: right;
}
.fa-plus:hover {
opacity: 0.8;
cursor: pointer;
}
#location-detail {
display: none;
}
a#location:focus + #location-detail {
display: block;
}
#media (max-width: 992px) {
.navbar-nav > li,
.navbar-nav > li > a,
.navbar-nav > li > a:link,
.navbar-nav > li > a:visited,
.navbar-nav > li > a:hover {
font-size: 1.05em;
}
}
#media (max-width: 767px) {
.navbar .navbar-brand {
position: absolute;
left: 50%;
margin-left: -110px !important;
display: block;
}
.navbar-collapse {
text-align: center;
}
.navbar-collapse li {
display: none;
}
.collapse.navbar-collapse {
background-color: #444;
position: fixed;
min-width: 100%;
min-height: 100%;
font-size: 1.3em;
text-align: center;
padding-top: 20px;
transition-property: all;
transition-duration: 0.2s;
transition-timing-function: linear;
}
.collapse.navbar-collapse li {
display: block;
margin-bottom: 15px;
}
}
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar top-bar"></span>
<span class="icon-bar middle-bar"></span>
<span class="icon-bar bottom-bar"></span>
</button>
<!--<img class="logo" src="../images/eclipse-new.png"/> -->
Eclipse Music
</div> <!-- end of navbar-header -->
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<!--<li><span class="glyphicon glyphicon-home"></span>Home</li>-->
<li>Effects</li>
<li>Guitar</li>
<li>Bass</li>
<li>Amps</li>
<li>Lessons</li>
<li class="dropdown">
About<!-- <i class="fa fa-caret-down"></i>-->
<ul class="dropdown-menu">
<li>Directions</li>
<li>Contact Us</li>
<li>Blog</li>
</ul>
</li>
</ul>
</div> <!-- end of collapse navbar-collapse -->
</div> <!-- end of container -->
</div> <!-- end of navbar navbar-default navbar-fixed-top -->
Here is my site in progress. I tried copying the styling and markup to JS Fiddle, but it wasn't matching what my webpage shows.
Using bootstrap.
I changed breakpoint to collapse menu in 991px.
Menu are collapsing, but stays expended in sm. Works fine in xs.
It looks like collapsing, but is not disappearing.
Can't figure put whats is causing that.
Link below.
https://jsfiddle.net/marko_lt/spa8Ls1d/
<div class="navbar navbar-default navbar-fixed-top" role="navigation" id="meniu">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#meniucollapse" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="logo-box">
<a class="navbar-brand" href="{% url 'home' %}">
<img id="logotipas" src="{% static 'images/log_pure_small.jpg' %}" alt="logo"/>
</a>
</div>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="meniucollapse">
<ul class="nav navbar-nav">
<li><a data-toggle="collapse" data-target="#meniucollapse" href="#paslaugos" ><span>1 link </span></a></li>
<li><a data-toggle="collapse" data-target="#meniucollapse" href="#marsrutas"><span>2 link </span></a></li>
<li><a data-toggle="collapse" data-target="#meniucollapse" href="#kainos"><span>3 link </span></a></li>
<li><a data-toggle="collapse" data-target="#meniucollapse" href="#taisykles"><span>4 link </span></a></li>
<li><a data-toggle="collapse" data-target="#meniucollapse" href="#kontaktai"><span>5 link </span></a></li>
</ul>
</div>
</div>
</
CSS:
.navbar-default {
background-image:none;
background-color: #373737;
}
/*BIG SCREENS*/
#media all and (min-width: 991px) {
.navbar-default .navbar-nav>.active>a,
.navbar-default .navbar-nav > li > a {
width: 120px;
height: 65px;
font-size: 16px;
border-left: 10px solid #178ACC;
transform: skewX(-45deg);
background-color: #000;
color: #f4ebeb;
}
.navbar-default .navbar-nav > li > a >span {
display:inline-block;
transform: skewX(45deg);
vertical-align: middle;
padding-top: 5px;
padding-left: 2px;
}
.navbar-default .navbar-nav > .active #uzsakymo-linkas {
background-color: #FC6607;
color:#fff;
margin:0px;
width:160px;
border-right: 10px solid #178ACC;
}
.navbar-default .navbar-nav > li>#uzsakymo-linkas > span {
padding-top: 0px;
padding-left: 0px;
text-align: center;
}
} /*end of big screens*/
/*SMALL SCREENS*/
#media (max-width: 991px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-collapse .collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar-nav>li {
float: none;
}
.navbar-default .navbar-nav>.active>a,
.navbar-nav>li>a
{
padding-top: 5px;
padding-bottom: 5px;
color: #727272;
width: 500px;
border-left: 5vw solid #178ACC;
height: 40px;
font-size: 16px;
color: #f4ebeb;
background-color: #000;
}
.navbar-default .navbar-nav > li > a >span {
display:inline-block;
vertical-align: middle;
padding-top: 5px;
padding-left: 2px;
}
.navbar-text {
float: none;
margin: 15px 0;
}
/*.navbar-collapse .collapse .in { */
.navbar-collapse .collapse .in {
display: block!important;
}
.collapsing {
overflow: hidden!important;
}
} /*end small screens*/
I changed your css-code for small-screen to css-code I used before and it worked fine, of course, I put your properties for li a span:
#media (max-width: 990px) {
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin: 7.5px -15px;
}
.navbar-nav>li {
float: none;
}
.navbar-default .navbar-nav>.active>a,
.navbar-nav>li>a {
padding-top: 5px;
padding-bottom: 5px;
color: #727272;
width: 500px;
border-left: 5vw solid #178ACC;
height: 40px;
font-size: 16px;
color: #f4ebeb;
background-color: #000;
}
.navbar-default .navbar-nav > li > a > span {
display:inline-block;
vertical-align: middle;
padding-top: 5px;
padding-left: 2px;
}
.navbar-text {
float: none;
margin: 15px 0;
}
/* since 3.1.0 */
.navbar-collapse.collapse.in {
display: block!important;
}
.collapsing {
overflow: hidden!important;
}
}
jsfiddle-link
I cant figure out how to make this transparent arrow to work when the link is ".active"
I created a bar underneath the navigation so the arrow could be transparent with the background, but I don't know how to make it be underneath the ".active" link when you click on it, any ideas to make the transparent arrow to work and be underneath the clicked element?
jsfiddle(please make the screen bigger because it's got media queries)
HTML
body {
background-image: url("http://www.crystalxp.net/galerie/img/th_13740.jpg");
}
#logo {
padding: 10px;
max-width: 210px;
display: inline-block;
margin: 5px auto 0 auto;
}
#media (min-width: 720px) {
#logo {
display: block;
float: left;
height: 54px;
max-width: auto;
width: 210px;
margin: 0px 5px 5px 5px;
padding: 0;
}
}
// header container
.header-container {
width: 100%;
background-color: #252525;
background-color: rgba(37, 37, 37, 0.97);
z-index: 2;
-webkit-box-shadow: 0 1px 4px 0 rgba(100, 100, 100, 0.7);
-moz-box-shadow: 0 1px 4px 0 rgba(100, 100, 100, 0.7);
box-shadow: 0 1px 4px 0 rgba(100, 100, 100, 0.7);
}
.nav-actions {
display: none;
margin: 0;
padding: 0;
list-style: none;
float: right;
}
#media (min-width: 720px) {
.nav-actions {
display: block;
}
}
.nav-actions li {
float: left;
}
#media (min-width: 720px) {
.nav-actions li {
margin-left: 10px;
}
}
#media (min-width: 960px) {
.nav-actions li {
margin-left: 20px;
}
}
.nav-actions li a:link,
.nav-actions li a:visited {
padding: 4px 20px;
display: block;
margin-top: 13px;
text-transform: uppercase;
font-weight: 600;
font-size: 16px;
text-decoration: none;
color: #e49e02;
border: 2px solid #e49e02;
}
.nav-actions li a:hover,
.nav-actions li a:active {
border: 2px solid #ffffff;
color: #ffffff;
}
.nav-actions li a.active {
text-decoration: underline;
}
.nav-list {
list-style-type: none;
padding: 0;
margin: 0;
overflow: hidden;
display: block;
margin: 0;
float: left;
padding: 0 0 0 0px;
display: none;
}
.nav-list li {
display: block;
float: left;
margin: 0;
}
.nav-list li:last-child {
margin-right: 0px;
}
#media (min-width: 720px) {
.nav-list {
display: block;
}
}
.nav-list li {
float: left;
}
.nav-list li a:link,
.nav-list li a:visited {
display: block;
color: #e49e02;
text-decoration: none;
text-transform: uppercase;
font-weight: 600;
}
#media (min-width: 720px) {
.nav-list li a:link,
.nav-list li a:visited {
padding: 15px 10px;
font-size: 0.85em;
}
}
#media (min-width: 960px) {
.nav-list li a:link,
.nav-list li a:visited {
padding: 15px 30px;
font-size: 1.3em;
}
}
.nav-list li a:hover,
.nav-list li a:active {
color: #ffffff;
}
.nav-list li a.active {
color: red;
}
.nav-list li a.active:after,
.nav-list li a.active:before {
content: '';
position: absolute;
top: 62px;
width: 56%;
padding-bottom: inherit;
background-color: rgba(37, 37, 37, 0.97);
}
.nav-list li a.active:before {
right: 49%;
-ms-transform-origin: 100% 100%;
-webkit-transform-origin: 100% 100%;
transform-origin: 100% 100%;
-ms-transform: skewX(-45deg);
-webkit-transform: skewX(-45deg);
transform: skewX(-45deg);
}
.nav-list li a.active:after {
left: 53%;
-ms-transform-origin: 0 100%;
-webkit-transform-origin: 0 100%;
transform-origin: 0 100%;
-ms-transform: skewX(45deg);
-webkit-transform: skewX(45deg);
transform: skewX(45deg);
}
<!--- header container --->
<header class="header-container">
<div class="header-container--inner">
<!--- site logo --->
<a href="/">
<img id="logo" src="http://placehold.it/100x50">
</a>
<!--- main nav --->
<ul class="nav-list">
<li>entries
</li>
<li><a class="" href="">event</a>
</li>
<li><a class="active" href="">store</a>
</li>
<li>archive
</li>
</ul>
<!--- main nav actions --->
<ul class="nav-actions">
<li>enter
</li>
</ul>
<!--- mobile nav link --->
<div class="small-navigation">
<a href="">
<i class="fa fa-bars"></i>
</a>
</div>
</div>
</header>
<!--- main wrapper --->
<div class="main-wrapper">
<!--- main container --->
<div class="main-container">