I'm working on a left navbar for Bootstrap, and it is working fine except for one little thing that is driving me crazy.
The hamburger menu is in the page for narrower screens but it is not visible. I know it is there because I can click on it and it works and I can see it when I inspect the element in Chrome.
I've included a minimal snippet. Click where the hamburger menu is supposed to be and you will see the menu expand. Can you make the hamburger menu show itself?
.navbar-left {
overflow: auto;
font-weight: 200;
color: #fff;
background-color: #3d486f;
position: fixed;
top: 0px;
width: 250px;
height: 100%;
}
.navbar-left a { color: #fff; }
.navbar-left-header { margin: 15px 0; }
.navbar-left ul, .navbar-left li { list-style: none; }
.navbar-clear { clear: left; }
#media (max-width: 767px) {
.navbar-left {
position: relative;
width: 100%;
margin-bottom: 10px;
}
.navbar-left .navbar-toggle { display: block; }
}
#media (min-width: 768px) {
#menu-content { display: block; }
.navbar-left .navbar-toggle { display: none; }
}
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div class="navbar-left">
<div class="navbar-left-header">
Title
<button type="button" data-toggle="collapse" data-target="#menu-content" aria-expanded="false" aria-controls="navbar" class="collapsed navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-clear"></div>
<ul id="menu-content" class="collapse">
<li>First</li>
<li>Second</li>
<li>Third</li>
<li>Fourth</li>
</ul>
</div>
</div>
You just need to add a background color to icon-bar, since it will inherit from the parent:
.navbar-toggle{
background-color: transparent;
background-image: none;
border: 1px solid transparent;
}
so add this:
.navbar-toggle .icon-bar {
background-color: #fff;
}
But the simplest way to get it right, it's adding navbar-default class to your navbar, so bootstrap will apply the defaults to the .icon-bar, and then you can extend it.
I would advice to check the bootstrap documentation for navbar properly, or check this example:
https://getbootstrap.com/examples/navbar/
Simply add a background color to .icon-bar
.navbar-toggle .icon-bar {
background-color: #fff;
}
Add a background-color on .icon-bar should do the trick.
.navbar-toggle .icon-bar{background-color:white;}
.navbar-left {
overflow: auto;
font-weight: 200;
color: #fff;
background-color: #3d486f;
position: fixed;
top: 0px;
width: 250px;
height: 100%;
}
.navbar-left a { color: #fff; }
.navbar-left-header { margin: 15px 0; }
.navbar-left ul, .navbar-left li { list-style: none; }
.navbar-clear { clear: left; }
#media (max-width: 767px) {
.navbar-left {
position: relative;
width: 100%;
margin-bottom: 10px;
}
.navbar-left .navbar-toggle { display: block; }
}
#media (min-width: 768px) {
#menu-content { display: block; }
.navbar-left .navbar-toggle { display: none; }
}
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<div class="navbar-left">
<div class="navbar-left-header">
Title
<button type="button" data-toggle="collapse" data-target="#menu-content" aria-expanded="false" aria-controls="navbar" class="collapsed navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-clear"></div>
<ul id="menu-content" class="collapse">
<li>First</li>
<li>Second</li>
<li>Third</li>
<li>Fourth</li>
</ul>
</div>
</div>
In my case, I forgot to add to :
put this in the head tag :
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
and this right below the closing body tag :
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
Related
I tried these two different solutions suggested here on SO :
How to keep Bootstrap 3 navbar as collapsed for all screen sizes
Change bootstrap navbar collapse breakpoint without using LESS
I've also tried many other different solutions suggesting more or less the same. None worked for me.
How can I keep Bootstrap 3 navigation bar collapsed on all screen sizes, both big and small?
This is the HTML :
<nav class="navbar navbar-default navbar-custom">
<div class="container-fluid">
<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>
<a class="navbar-brand" href="index.html">
<img class="img-responsive imglogoheader" src="images/logo1.png">
</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="">Home</li>
<li>Profile</li>
<li>Settings</li>
<ul style="display:none !important;" class="nav navbar-nav navbar-right"></ul>
</div>
</div>
</nav>
To make the navbar menu toggle-able on all responsive intervals in Bootstrap 3, you need this snippet:
#media (min-width: 768px) {
.navbar {
.navbar-header,
.navbar-nav>li {
float: none;
}
.navbar-nav {
float: none;
margin: 7.5px -15px;
}
.navbar-toggle {
display: block;
margin-right: 0;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.navbar-collapse.collapse {
display: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.navbar-text {
float: none;
margin: 15px 0;
}
.navbar-collapse.collapse.in {
display: block;
}
.collapsing {
overflow: hidden;
}
}
}
Please note it's SCSS. If you want it as CSS, you could copy/paste it from the demo at the end of the answer.
The solution is largely adapted from this answer but I thought it's worth posting it as a clean one rather then telling you to play with breakpoints and clean it up.
Most importantly, it doesn't use !important.
Feel free to upvote the original answer. It is an exceptional solution to a difficult problem, especially considering the complexity of Bootstrap 3's navbar collapse logic mechanics (it's done by the collapse plugin, in JavaScript - which makes it difficult to debug and/or reverse engineer).
See it working:
#media (min-width: 768px) {
.navbar .navbar-header,
.navbar .navbar-nav>li {
float: none;
}
.navbar .navbar-nav {
float: none;
margin: 7.5px -15px;
}
.navbar .navbar-toggle {
display: block;
margin-right: 0;
}
.navbar .navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.navbar .navbar-collapse.collapse {
display: none;
}
.navbar .navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.navbar .navbar-text {
float: none;
margin: 15px 0;
}
.navbar .navbar-collapse.collapse.in {
display: block;
}
.navbar .collapsing {
overflow: hidden;
}
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<nav class="navbar navbar-default navbar-custom">
<div class="container-fluid">
<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>
<a class="navbar-brand" href="index.html">
Logo
</a>
</div>
<div class="collapse .navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="">Home</li>
<li>Profile</li>
<li>Settings</li>
</ul>
</div>
</div>
</nav>
The answer suggested by tao worked at 60% but not all the way for me. Here I share what finally did it for me. In my custom.css I override bootstrap with custom rules
custom.css
#media (min-width: 768px) {
.navbar .navbar-header,
.navbar .navbar-nav>li {
float: none;
}
.navbar .navbar-nav {
float: none;
margin: 7.5px -15px;
}
.navbar .navbar-toggle {
display: block;
margin-right: 0;
}
.navbar .navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.navbar .navbar-collapse.collapse {
display: none;
}
.navbar .navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.navbar .navbar-text {
float: none;
margin: 15px 0;
}
.navbar .navbar-collapse.collapse.in {
display: block;
}
.navbar .collapsing {
overflow: hidden;
}
}
I had to comment out this line in bootstrap.min.cs to make it all work :
.navbar-collapse.collapse {
/* display:block!important;*/
height:auto!important;
padding-bottom:0;
overflow:visible!important
}
i'm trying to change the width of my navbar which is fixed and also has a navbar-collapse property that i want to keep when screen size changes.
I also added in the Bootstrap i am using for this page, so at the moment with the code below, the navbar is fixed but is full width, it collapses when you change to mobile site, so the only thing i want is to change the width from full width so that there is atleast 30% open space on either side of the navbar so it will be centred to the page.
and also adding a logo/image to the navbar only when its collapsed
Hope you can help me!
<html>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<style>
.navbar-nav.nav-justified > li{float:none; }
.navbar{
background-color:white;
font-family: Amatic SC;
border:none;
font-size: 25px;
letter-spacing: 1px;
text-align:center;
}
.navbar:hover,
.navbar:active {
color: black;
transition: background-color 0.3s ease-oin,
color 0.3s ease-out;
}
.navbar-inverse .navbar-nav>li>a:hover {
color: black;
}
#media (max-width: 981px) {
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0%;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}
}
</style>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" "col-xs- col-xs-offset-0 col-md-6 col-md-offset-3" >
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-collapse collapse" style="text-align:center" >
<ul class="nav navbar-nav nav-justified">
<li id="scrollDetails">Details</li>
<li id="scrollDirections">Directions</li>
<li id="navRsvp">RSVP</li>
<li id="scrollBucket">Bucket List</li>
<li id="scrollAccommodation">Accommodation</li>
</ul>
</div>
</nav>
</body>
</html>
You have to modify the width and centrally align your code in the media queries for the expected behaviour in mobile view.
You have to add the following css:
#media (max-width: 981px) {
.navbar {
width: 30%;
margin: auto;
}
}
Refer code:
.navbar-nav.nav-justified > li {
float: none;
}
.navbar {
background-color: white;
font-family: Amatic SC;
border: none;
font-size: 25px;
letter-spacing: 1px;
text-align: center;
}
.navbar:hover,
.navbar:active {
color: black;
transition: background-color 0.3s ease-oin, color 0.3s ease-out;
}
.navbar-inverse .navbar-nav>li>a:hover {
color: black;
}
#media (max-width: 981px) {
.navbar {
width: 30%;
margin: auto;
}
.navbar-left,
.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.navbar-fixed-top {
top: 0%;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in {
display: block !important;
}
}
<nav class="navbar navbar-inverse navbar-fixed-top col-xs-offset-0 col-md-6 col-md-offset-3">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-collapse collapse" style="text-align:center">
<ul class="nav navbar-nav nav-justified">
<li id="scrollDetails">Details
</li>
<li id="scrollDirections">Directions
</li>
<li id="navRsvp">RSVP
</li>
<li id="scrollBucket">Bucket List
</li>
<li id="scrollAccommodation">Accommodation
</li>
</ul>
</div>
</nav>
I'm sorry for asking this question, but I've search through stack overflow for weeks and haven't been able to rectify my problem. My nav bar is left justified; I need it to center. I have tried applying margin: 0px auto; to every element within the hierarchy of the <nav> along with text-align: center; but nothing is centering it.
It's a Bootstrap 3 framework. Here's the code and my external CSS in addition to the bootstrap.min.css file:
.navbar {
margin-bottom: 0;
border-radius: 0;
}
.row.content {
height: 450px
}
.sidenav {
padding-top: 20px;
background-color: #f1f1f1;
height: 100%;
}
footer {
background-color: #555;
color: white;
padding: 15px;
font-family: "IM Fell DW Pica", serif;
font-size: 18px;
}
#media screen and (max-width: 767px) {
.sidenav {
height: auto;
padding: 15px;
}
.row.content {
height: auto;
}
}
#banner-img {
margin: 0px auto;
}
header {
background-color: #394650;
/* background color of header */
}
nav {
font-family: "IM Fell DW Pica", serif;
/* font style of nav bar */
font-size: 23px;
/* font size of nav bar */
}
#myNavBar ul li {
text-align: center;
}
/* FOR SMALL SCREENS */
#media screen and (max-width: 767px) {
nav {
font-size: 40px;
/* changes font size on smaller screens */
}
/* sets dimensions for embedded video on small screens */
#intro-video-div {
height: auto;
width: auto;
}
section h1 {
font-size: 40px;
}
section p {
font-size: 25px;
}
}
/* FOR BIG SCREENS */
#media screen and (min-width: 768px) {
/* sets dimensions for embedded video on larger screens */
#intro-video-div {
width: 560px;
height: 315px;
}
section h1 {
font-size: 36px;
}
section p {
font-size: 20px;
}
#content-ads-holding-div {
height: 750px;
}
.img-responsive {
margin: auto;
}
}
section,
h1,
p {
font-family: "IM Fell DW Pica", serif;
text-align: center;
position: static;
}
#intro-video-div {
margin: 0px auto;
position: static;
text-align: center;
}
#intro-video {
width: 100%;
height: 100%;
}
#nav-div-center,
#nav-ul {
margin: 0px auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse">
<div class="container-fluid" id="navbar-container">
<div class="collapse navbar-collapse" id="myNavbar">
<div id="nav-div-center">
<ul class="nav navbar-nav" id="nav-ul">
<li class="active" id="home">Home</li>
<li id="episodes">Episodes</li>
<li id="research">Research</li>
<li id="store">Store</li>
<li id="support">Support</li>
<li id="communicate">Communicate</li>
<li id="affiliations">Affiliations</li>
</ul>
</div>
</div>
</div>
</nav>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
You can see the actual website at http://www.kspavia.com/bootstrap.php
try the below css to make navbar center.
#media (min-width: 768px){
.navbar-nav{
margin: 0 auto;
float: none;
display: table;
}
}
If you want to center the navigation you need to assign a width. A block level element will always expand as wide as it can.
#nav-ul {
max-width: 780px;
}
Depending on what you ultimately want to do (justify the links across the nav or center in the links in the nav) you simple have to change the display and float properties to do either.
Note: I adjusted the font size above 768px to prevent any links from overflowing on a reduced viewport.
Here are two working examples. View at FullPage.
Distributed (justified) Links Example:
.navbar.navbar-inverse {
margin-bottom: 0;
font-family: "IM Fell DW Pica", serif;
font-size: 22px;
}
/*Distributed Links Starts*/
#media (min-width: 768px) {
.navbar.navbar-inverse .navbar-nav {
display: table;
width: 100%;
}
.navbar.navbar-inverse .navbar-nav > li {
display: table-cell;
float: none;
}
.navbar.navbar-inverse .navbar-nav > li > a {
text-align: center;
}
.navbar.navbar-inverse > .container-fluid {
margin-right: 0;
margin-left: 0;
padding-left: 0;
padding-right: 0;
}
}
/*Distributed Links Ends*/
#media screen and (max-width: 767px) {
.navbar.navbar-inverse .navbar-nav > li > a {
font-size: 40px;
padding: 20px 15px;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar" 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>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active" id="home">Home
</li>
<li id="episodes">Episodes
</li>
<li id="research">Research
</li>
<li id="store">Store
</li>
<li id="support">Support
</li>
<li id="communicate">Communicate
</li>
<li id="affiliations">Affiliations
</li>
</ul>
</div>
</div>
</nav>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
Center Links Example:
.navbar.navbar-inverse {
margin-bottom: 0;
font-family: "IM Fell DW Pica", serif;
font-size: 18px;
}
/*Centered Links Starts*/
#media (min-width: 768px) {
.navbar.navbar-inverse .navbar-nav {
width: 100%;
text-align: center;
}
.navbar.navbar-inverse .navbar-nav > li {
display: inline-block;
float: none;
}
}
/*Centered Links Ends*/
#media screen and (max-width: 767px) {
.navbar.navbar-inverse .navbar-nav > li > a {
font-size: 40px;
padding: 20px 15px;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar" 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>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active" id="home">Home
</li>
<li id="episodes">Episodes
</li>
<li id="research">Research
</li>
<li id="store">Store
</li>
<li id="support">Support
</li>
<li id="communicate">Communicate
</li>
<li id="affiliations">Affiliations
</li>
</ul>
</div>
</div>
</nav>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
if you want to make your navigation center aligned. Just update your existing css second-bootstrap-stylesheet.css line no 119 as per below css:-
#nav-div-center, #nav-ul {
width: 78%;
float: none;
}
You can just use .container instead of .container-fluid if you want .navbar block to be on center or use apply styles:
#media (min-width: 768px){
.navbar-nav {
float: none;
text-align: center;
}
.navbar-nav > li {
display: inline-block;
float: none;
}
}
i am trying to make my bootstrap navbar collapse if the webpage width is under 1024px but it collapses under 700ish pixels width. I have tried alot of solutions that i googeled but no luck. I have tryed CSS from this post "Bootstrap 3 Navbar Collapse" it has a problem similar to mine. But no matter what i do i just wont collapse after 1024px width. I have tryed copying their html(boostrap navbar)+css just to see if that will work but no luck.
My CSS
#media (max-width: 1024px) {
ul.nav.navbar-nav{
margin-left:-15px;
}
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}
}
My Bootstrap navbar
<nav>
<img class="kopakuttlogo" src="kopakuttlogo.jpg" alt="Logo" width="400" height="400"/>
<div class="navigatsioon">
<div class="navbar navbar-default" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
<div class="container-fluid">
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>AVALEHT</li>
<li>HINNAKIRI</li>
<li>RENDITINGIMUSED</li>
<li>TEHNIKA</li>
<li></span>KONTAKT</li>
</ul>
</li>
</ul>
</div><!-- /.navigatsioon -->
</div>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
Hey i got it to work with adding .navigatsioon everywhere
#media (max-width: 1024px) {
.navigatsioon ul.nav.navbar-nav{
margin-left:-15px;
}
.navigatsioon .navbar-header {
float: none;
}
.navigatsioon .navbar-left,.navbar-right {
float: none !important;
}
.navigatsioon .navbar-toggle {
display: block;
}
.navigatsioon .navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navigatsioon .navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navigatsioon .navbar-collapse.collapse {
display: none!important;
}
.navigatsioon .navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navigatsioon .navbar-nav>li {
float: none;
}
.navigatsioon .navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.navigatsioon .collapse.in{
display:block !important;
}
}
Bootstrap. How to change the navbar collapse breakpoint
Go to the Customize page / Grid system and set in the field #grid-float-breakpoint the value that you need.
Click the Compile and Download button at the bottom of the page.
Extract the files bootstrap.css and bootstrap.min.css from the resulting archive.
Use them instead of the standard files bootstrap.css and bootstrap.min.css on your site.
Nothing else is needed.
I have header nav bar and Side nav bar named vertical menu. I couldn't fix the position of my nav bar close to float left. It is having some gaps, I tried adjusting the position still missing something. Please see image for reference
In case if I include another menu now , if I click profile that also kind of not working out, because of the position of the side nav bar.
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<nav class="navbar top-color">
<!--nav header Div-->
<div class="container-fluid">
<div class="col-sm-1"><a class="navbar-head" style="text-decoration:none; color:white;" href="#"><h1>Bootstrap Case</h1></a>
</div>
</div>
</nav>
<nav class="navbar navbar-inverse verticalmenu" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Main Menu</a>
<br><br>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li><span class="glyphicon glyphicon-dashboard vmenu"></span> Dashboard
</li>
<li class="active"><span class="glyphicon glyphicon-user vmenu"></span> Profile
</li>
<li><span class="glyphicon glyphicon-edit vmenu"></span>Skill Test
</li>
<li><span class="glyphicon glyphicon-tags vmenu"></span>Interviews
</li>
<li><span class="glyphicon glyphicon-off vmenu"></span>Logout
</li>
</ul>
</div>a
<!-- /.navbar-collapse -->
</nav>
CSS :
<style>
.top-color {
background-color: aquamarine;
margin-bottom: 0;
}
.firstmenu {
margin-bottom: 0;
}
#media (min-width: 768px) {
.top-color{
width:100%;
margin: 0;
height:5em;
padding-top:10px;
text-align: center;
background: #3399ff;
padding-bottom: 30px;
}
.firstmenu .navbar-brand {
padding-left:155px;
}
.firstmenu li{
padding-left:50px;
}
.firstmenu .active{
width:250px;
}
select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.verticalmenu .navbar-toggle {
display: none ;
}
.navbar.verticalmenu {
float: left;
width: 200px;
height: 100%;
}
.verticalmenu .collapse.navbar-collapse.navbar-ex1-collapse {
display: block;
float: left;
}
.verticalmenu .active {
width:200px;
}
.verticalmenu .navbar-collapse {
height: auto;
border-top: 0;
box-shadow: none;
max-height: none;
padding-left: 0;
padding-right: 0;
}
.verticalmenu .navbar-collapse.collapse {
display: block !important;
width: auto !important;
padding-bottom: 0;
overflow: visible !important;
}
.verticalmenu .navbar-collapse.in {
overflow-x: visible;
}
.verticalmenu .navbar {
max-width: 100px;
margin-right: 0;
margin-left: 0;
}
.verticalmenu .navbar-nav,
.verticalmenu .navbar-nav > li,
.verticalmenu .navbar-left,
.verticalmenu .navbar-right,
.verticalmenu .navbar-header {
float: none !important;
}
.verticalmenu .navbar-right .dropdown-menu {
left: 0;
right: auto;
}
.verticalmenu .navbar-collapse .navbar-nav.navbar-right:last-child {
margin-right: 0;
}
.vmenu{
text-align: center;
}
}
</style>
change the below selector
.navbar.verticalmenu {
width: 200px;
height: 100%;
}
Remove the float:none from .verticalmenu .navbar-header.