Navbar search box in the dropdown menu crashes other navbar icons - html

.navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:focus, .navbar-default .navbar-nav > .open > a:hover {
background-color: transparent !important;
}
.nav > li a.dropdown-toggle {
text-align: right;
}
.dropdown-menu {
min-width: 20px !important;
}
.nav>li{vertical-align:top}
/* navbar-icon */
.nav {
// display: flex;
width: 100%;
}
.navbar-default .navbar-nav > li > a:focus, .navbar-default .navbar-nav > li > a:hover {
background-color: transparent;
}
.nav > li {
display: inline-block !important;
}
.nav_li_last_options {
float: right;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!--navbar start-->
<nav class="navbar navbar-default navbar-fixed-top navbar_base">
<div class="container-fluid padding_right_0">
<ul class="nav navbar-nav navbar_ul_base" style="max-height: 50px;">
<li><i class="glyphicon glyphicon-comment"></i></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="padding: 15px; text-align: left">
<i class="glyphicon glyphicon-search"></i>
</a>
<ul class="dropdown-menu" style="width: 100%;">
<li>
<form class="navbar-form" style="width: 100%; margin: auto">
<div class="input-group input-group-sm">
<input class="form-control" placeholder="Search" id="searchbar" type="text">
<div class="input-group-btn">
<i class="btn btn-default"><i class="glyphicon glyphicon-search"></i>
</i>
</div>
</div>
</form>
</li>
</ul>
</li>
<li class="nav_li_last_options dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="padding: 15px;">
<i class="glyphicon glyphicon-option-horizontal"></i>
</a>
<ul class="dropdown-menu dropdown_menu_base">
<li>JavaScript</li>
</ul>
</li>
</ul>
</div>
</nav>
options: bootstrap3(3.3.7) and jquery3
I made navbar that has search icon. When I click search icon, search box in the dropdown menu will be opened.
But, On browser's width < 768, when I click search Icon, navbar and other icons are crashed.
Is there any good way to fix it?
How can I fix it?

According to bootstrap official documentation.
Changing the collapsed mobile navbar breakpoint
The navbar collapses into its vertical mobile view when the viewport is narrower than #grid-float-breakpoint and expands into its horizontal non-mobile view when the viewport is at least #grid-float-breakpoint in width. Adjust this variable in the Less source to control when the navbar collapses/expands. The default value is 768px (the smallest "small" or "tablet" screen).
look Official documentation may help you

Related

Cannot collapse bootstrap navbar on specific resolution

I'm trying to collapse the Bootstrap navbar when the screen width is 1280px but instead of getting the navbar collapsed, the Navbar goes on top, this is my code:
body {
padding-top: 90px;
}
#media (min-width: 1280px) {
body {
padding-top: 0;
}
}
#media (min-width: 1280px) {
body {
margin-left: 232px;
}
}
.navbar.fixed-left {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1030;
}
#media (min-width: 1280px) {
.navbar.fixed-left {
bottom: 0;
width: 232px;
flex-flow: column nowrap;
align-items: flex-start;
}
.navbar.fixed-left .navbar-collapse {
flex-grow: 0;
flex-direction: column;
width: 100%;
}
.navbar.fixed-left .navbar-collapse .navbar-nav {
flex-direction: column;
width: 100%;
}
.navbar.fixed-left .navbar-collapse .navbar-nav .nav-item {
width: 100%;
}
.navbar.fixed-left .navbar-collapse .navbar-nav .nav-item .dropdown-menu {
top: 0;
}
}
#media (min-width: 1280px) {
.navbar.fixed-left {
right: auto;
}
.navbar.fixed-left .navbar-nav .nav-item .dropdown-toggle:after {
border-top: 0.3em solid transparent;
border-left: 0.3em solid;
border-bottom: 0.3em solid transparent;
border-right: none;
vertical-align: baseline;
}
.navbar.fixed-left .navbar-nav .nav-item .dropdown-menu {
left: 100%;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet"
id="theme_link"
href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/4.3.1/materia/bootstrap.min.css"/>
<nav class="navbar navbar-expand-md navbar-dark bg-primary fixed-left">
<a class="navbar-brand" href>Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link">Home</a>
</li>
<li class="nav-item">
<a class="nav-link">About</a>
</li>
<li class="nav-item">
<a class="nav-link">Contact</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu">
<a class="dropdown-item">Action</a>
<a class="dropdown-item">Another action</a>
<a class="dropdown-item">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item">Separated link</a>
<a class="dropdown-item">One more separated link</a>
</div>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" data-class="fixed-left">
<i class="fa fa-arrow-left"></i>
Fixed Left
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-class="fixed-top">
<i class="fa fa-arrow-up"></i>
Fixed Top
<small>(original)</small>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-class="fixed-right">
<i class="fa fa-arrow-right"></i>
Fixed Right
</a>
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="jumbotron">
<h1 class="display-4">
Bootstrap Navbar Sidebar
<br>
<small>Fixed to Left or Right</small>
</h1>
<p>
<strong>
Use classic Bootstrap navbar as sidebar, on left or right side.
</strong>
</p>
<p>
<a class="github-button" href="https://github.com/mladenplavsic/bootstrap-navbar-sidebar"
data-icon="octicon-star" data-show-count="true"
aria-label="Star mladenplavsic/bootstrap-navbar-sidebar on GitHub">Star</a>
<a class="github-button" href="https://github.com/mladenplavsic/bootstrap-navbar-sidebar/fork"
data-icon="octicon-repo-forked" data-show-count="true"
aria-label="Fork mladenplavsic/bootstrap-navbar-sidebar on GitHub">Fork</a>
<a class="github-button" href="https://github.com/mladenplavsic"
aria-label="Follow #mladenplavsic on GitHub">Follow #mladenplavsic</a>
</p>
<p>Same as when using <code>.fixed-top</code> for navbar - add class <code>.fixed-left</code> or <code>.fixed-right</code>
where needed.</p>
<p>Click buttons below, and appropriate class will be added to example navbar.</p>
<div class="btn-group" role="group">
<button type="button" data-class="fixed-left" class="btn btn-primary">
<i class="fa fa-arrow-left"></i>
Fixed Left
</button>
<button type="button" data-class="fixed-top" class="btn btn-primary">
<i class="fa fa-arrow-up"></i>
Fixed Top
<small>(original)</small>
</button>
<button type="button" data-class="fixed-right" class="btn btn-primary">
<i class="fa fa-arrow-right"></i>
Fixed Right
</button>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="form-group">
<label>
Select another bootstrap theme from
Bootswatch
</label>
<select class="form-control width-md" id="theme_select" onchange="selectTheme(value)"></select>
</div>
</div>
</div>
</div>
As you can see I setted 1280px in the media queries, but for some reason the navbar instead of collapse, is displayed as topbar, what I did wrong?
Bootstrap's closest breakpoint is at 1200px. I'd recommend sticking to it, because that way you avoid excessive layout changes. If you're willing to move your breakpoints to #media 1200px to match Bootstrap, you can simply change your class .navbar-expand-md to .navbar-expand-xl, and that's it.
Codepen: https://codepen.io/Terrafire123/pen/NWRKdKR
Edit:
If all you want to do is simply prevent the sidebar from overlapping the body, you can add this:
#media (min-width: 1200px) {
body {
margin-left: 232px !important;
}
}
(This already exists in your original code, but without !important, it's getting overwritten to margin:0; by Bootstrap's default settings.)

How to display elements horizontally using bootstrap v3.3.7?

I am trying to get the elements in a navbar to show up and the issue is that they do albeit vertically.
I have tried to add the code display:inline-block to all css navbar-nav selectors , but to no avail. In the end, I have tried to change the "display:block" code in the "nav" selector to display:inline-block.
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: inline-block;
}
.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 {
float: left;
margin: 0;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 15px;
padding-bottom: 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;
}
}
<html>
<head>
<title>This is a webpage!</title>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
<div class="container topnav">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand topnav" href="#"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
About
</li>
<li>
Login
</li>
<li>
Sign Up
</li>
<li>
Symptoms
</li>
<li>
Insurances
</li>
</ul>
</div>
</div>
</nav>
</body>
</html>
The links "About", "Login", "Sign Up", "Symptoms", and "Insurances" should all be lined up horizontally. However, no matter what I do, they only lign up vertically.
Try adding the following style:
.navbar-nav > li {
float: left;
}
Alternatively, you can add display: inline-block; to the li elements specifically:
.navbar-nav > li {
display: inline-block;
}
First of all if you are using bootstrap 4, then there is no need of writing this all CSS at all, BS 4 gives you great solutions for such thing only using some classes properly.
Check this out
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand-sm navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo03" aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Logo</a>
<div class="collapse navbar-collapse" id="navbarTogglerDemo03">
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item">
About
</li>
<li class="nav-item">
Login
</li>
<li class="nav-item">
Sign Up
</li>
<li class="nav-item">
Symptoms
</li>
<li class="nav-item">
Insurances
</li>
</ul>
</div>
</nav>
Just use the classes properly, You can see all these class options form here.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="active">Link <span class="sr-only">(current)</span></li>
<li>Link</li>
<li>
Dropdown
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
Same goes with Bootstrap 3, Proper use of Classes will help you to get the desired result. See this example

Website header col and pull right issue

I was developing an example using Bootstrap 3.3.5. I was trying to create a header (logo + navigation + search) using the grid system. My problem is that the search input collapses to a second screen if I don't set a width on the nav.
I created the following CodePen to show the problem:
http://codepen.io/giancorzo/pen/jbqGJo
Like I said my solution was to add the following code:
nav {
width: 503px;
}
But this doesn't work well in responsive (I don't want to patch it for each breakpoint).
Any idea? Perhaps I'm doing the HTML wrong.
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
header {
padding: 1%;
}
header h1 {
margin-top: 0;
}
nav ul {
list-style: none;
margin: 0px;
}
nav ul li {
float: left;
padding: 0% 2%;
}
nav ul li:last-child {
padding-right: 0px;
}
nav ul li a {
line-height: 36px;
text-decoration: none;
display: block;
}
nav ul li .separator {
line-height: 36px;
}
nav .navbar-form {
margin: 0px;
padding: 0px;
}
#media (max-width: 768px) {
nav {
width: auto;
}
header h1 {
font-size: 30px;
}
}
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<header>
<div class="container">
<div class="row">
<div class="col-xs-4">
<h1>Site name</h1>
</div>
<div class="col-xs-8">
<nav class="pull-right">
<ul class="clearfix">
<li>
<a href="#">
<i class="glyphicon glyphicon-home"></i>
<span>Noticias</span>
</a>
</li>
<li>
<a href="#">
<i class="glyphicon glyphicon-home"></i>
<span>Enlaces RSS</span>
</a>
</li>
<li class="hidden-xs">
<div class="separator">|</div>
</li>
<li class="hidden-xs">
<div class="search">
<form class="navbar-form" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Ingresa tu búsqueda">
</div>
<button type="submit" class="btn btn-default">Buscar</button>
</form>
</div>
</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
This might give you some ideas if nothing else. Pretty minimal.
.navbar .navbar-brand {
font-size: 35px;
color: #444;
}
.navbar .navbar-toggle .icon-bar {
background: #444;
}
.navbar .navbar-right .separator {
margin-top: 12px;
margin-left: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" 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> <a class="navbar-brand" href="#">Site Name</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<form class="navbar-form navbar-right hidden-xs" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Ingresa tu búsqueda">
</div>
<button type="submit" class="btn btn-default">Buscar</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><i class="glyphicon glyphicon-home"></i> Noticias
</li>
<li><i class="glyphicon glyphicon-home"></i> Enlaces RSS
</li>
<li class="separator hidden-xs">|</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>

Bootstrap horizontal dropdown-menu?

I'd like a bootstrap dropdown menu where the links are horizontal. Unfortunately, I'm having trouble with getting the width correct. The only way I can seem to make it happen is set the min-width to some arbitrary number. I'd like to do this responsively.
http://jsfiddle.net/3CwzH/
#import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');
.dropdown-menu>li>a {
display: inline;
}
.dropdown-menu {
min-width: 500px;
}
<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"></script>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Drop it
</button>
<ul class="dropdown-menu" role="menu">
<li>
Google
Facebook
</li>
</ul>
</div>
I have solved your problem. View this JSFiddle for demonstration.
HTML
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Drop it</button>
<ul class="dropdown-menu" role="menu">
<li> Google
</li>
<li> Facebook
</li>
</ul>
</div>
CSS
#import url('http://getbootstrap.com/dist/css/bootstrap.css');
.dropdown-menu > li {
display: inline-block;
float:left;
}
.open > ul {
display: inline-flex !important;
}

fixed bottom navbar - how to get the links spread out over full size and responsible (with %?) navbar-justified wont work

:)
I m fiddeling around with my bootstrap fixed bottom navbar..
its working kinda ..
But my navbar links wont go justified .. i tried everything i could think about..
i want to have it responsive soo the code i m currantly having (60px padding) is just the best i came up with, - looks soo aweful if it resizes.. :(
thx a lot!!!
<!--NAVBAR-->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<li class="active"><a class="navbar-brand" href="#"><img src="Bilder/grafik4.jpg" type="picture/jpg"/></a></li>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>F</li>
<li>Z</li>
<li>V</li>
<li>Ns</li>
<li>Englisch</li>
<li class="dropdown">
Kontakt und Impressum<b class="caret"></b>
<ul class="dropdown-menu">
<li>A</li>
<li>Kontakt</li>
<li class="divider"></li>
<li>Webseitengestaltung</li>
<li>Foto und Film</li>
<li class="divider"></li>
<li>Copyright 2014</li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<!--NAVBAR ENDE-->
the custom css is (other than that i used the bootstrap 3 one):
`
.navbar-brand {
float: left;
font-size: 18px;
height: 50px;
line-height: 20px;
padding-left: 40px;
padding-top:5px;
text-decoration: none;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
background-color: transparent;
color:black;
text-decoration:underline;
}
.navbar-default .navbar-nav > li > a {
color: grey;
text-decoration: none;
width: 100%;
padding-left:60px;
}
.navbar-nav > li > a {
padding-top: 15px;
padding-bottom: 15px;
size: 60px;
margin: 14,82% 0 0 10%;
}
.navbar-default {
background-color: #FFFFFF;
border-color: #E7E7E7;
}
.dropdown-menu > li > a {
color: grey;
}
.dropdown-menu> li > a:hover,
.dropdown-menu> li > a:focus {
background-color: transparent;
color:black;
text-decoration:underline;
}
`
Check this solution (if I understand correct what you want). JsFiddle:
I just replaced <ul class="nav navbar-nav"> with <ul class="nav custom-menu nav-justified">.
The nav-justified is provided by bootstrap.
Also I made few modifications to your css.
HTML:
<!--NAVBAR-->
<nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<li class="active"><a class="navbar-brand" href="#">
<img src="http://placehold.it/20x20" type="picture/jpg" /></a>
</li>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav custom-menu nav-justified">
<li>F</li>
<li>Z</li>
<li>V</li>
<li>Ns</li>
<li>Englisch
</li>
<li class="dropdown">Kontakt und Impressum <b class="caret"></b>
<ul class="dropdown-menu">
<li>A</li>
<li>Kontakt</li>
<li class="divider"></li>
<li>Webseitengestaltung</li>
<li>Foto und Film</li>
<li class="divider"></li>
<li>Copyright 2014</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!--NAVBAR ENDE-->
CSS:
.navbar-default .custom-menu > li a {
color: grey;
}
.dropdown-menu > li > a:hover {
color: white;
}
.custom-menu > li > a {
padding-top: 15px;
padding-bottom: 15px;
}
.navbar-default {
background-color: #FFFFFF;
border-color: #E7E7E7;
}
.custom-menu > li > a:hover {
background-color: transparent;
color:black;
text-decoration:underline;
}
.navbar-default .dropdown.open {
background-color: #eee;
color:black;
text-decoration:underline;
}
.nav>li>a{
padding:15px 0;
}
EDIT:
JsFiddle
To make dropdown menu as before add few things:
Add id="menu" for ul element:
Add new css class. It's need to align to center menu items when they are collapsed:
.navbar-nav{
margin:inherit !important;
}
Add javascript that will replace custom-menu class to navbar-nav class when toggle button is visible; otherwise it will do opposite thing.
$(function () {
$(window).resize(function () {
changeMenu();
});
changeMenu();
function changeMenu() {
if ($(".navbar-toggle").is(":visible")) {
$("#menu").removeClass("custom-menu").addClass("navbar-nav");
} else {
$("#menu").removeClass("navbar-nav").addClass("custom-menu");
}
}
});
Not sure if this is what you are after, but here is a codepen with a fixed menu at the bottom of the page. It's elements are centered using text-align:center for the ul. The navbar is 'responsive' as it resizes with the window. However for a proper responsive design you should use #media queries to set specific rules for different devices.
hope this helps.