I have the following:
Basically, I want the text "Home" to begin in line with the edge of the car picture. The last nav item should end on the right´. The Navbar is placed inside of a container-fluid. All li-elements between "Home" and "Inscriptions & Contact" should be centered. How can I accomplish that?
My Code:
<nav class="navbar navbar-default text-uppercase">
<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>
</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">
<li class="nav-first">Home</li>
<li>Instructeurs</li>
<li>VĂ©hicules</li>
<li>Examen & Liens</li>
<li class="nav-last">Inscriptions & Contact</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
And this is what I changed in my custom css file:
#font-face {
font-family: MyriadPro;
src: url("../fonts/MyriadPro-Regular.otf");
}
.navbar {
font-family: "MyriadPro", sans-serif;
font-size: 18px;
}
.navbar-default {
background-color: inherit !important;
border-color: none !important;
text-align: center;
}
.nav > li > a {
padding-right: 50px !important;
padding-left: 50px !important;
}
.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
.navbar .navbar-collapse {
text-align: center;
}
.active {
background-color: gray;
border-radius: 15px;
}
.navbar-nav>.active>a, .navbar-nav>.active>a:hover, .navbar-nav>.active>a:focus {
color: #8D1917 !important;
}
You can try this using table layout (similar to btn-group-justified in Bootstrap).
CSS:
.container-fluid > .navbar-collapse,
.container-fluid > .navbar-header,
.container > .navbar-collapse,
.container>.navbar-header {
margin-left: -15px;
margin-right: -15px;
}
.navbar-nav-justified {
display: table;
width: 100%;
table-layout: fixed;
}
.navbar-nav-justified > li {
display: table-cell;
vertical-align: middle;
float: none;
width: 100%;
}
CODEPEN
Related
I'm trying to remove the bootstrap whitespace between my menu and the following section. My menu HTML is:
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<ul class="navbar-brand">
<li><img src="{% static 'img/apps-png.png' %}" width="150px" alt="appsrfun logo" /></li>
</ul>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Mobile Apps</li>
<li>Android</li>
<li>Apple</li>
<li>Download</li>
<li>Tags</li>
</ul>
</div>
</div><!-- .container -->
</nav>
If I inspect each element the bottom border, padding and margin are all set to 0px. There is a mysterious white space between the end of <div class="collapse navbar-collapse" id="myNavbar"> and the end of <ul class="nav navbar-nav">. The former has a shows a height of 106px while the latter shows 100px but neither has border, margin or padding. How do I align them?
Thanks
EDIT
I've included my CSS to remove the bootstrap standard margins and padding
/* Navbar */
.navbar .navbar-nav {
display: inline-block;
float: none;
}
.navbar .navbar-collapse {
text-align: center;
}
.navbar .nav > li > a:link, .navbar .nav > li > a:visited {
color: #f7931e;
height: 100px;
padding-top: 40px;
margin-bottom: 0px;
}
.navbar .nav > li > a:hover, .navbar .nav > li > a:active {
background-color: #f7931e;
color: #ffffff;
border-bottom: 6px solid #ffff01;
}
.navbar {
margin-bottom: 0px;
padding-bottom: 0px;
}
.navbar-brand {
list-style-type: none;
margin-bottom: 0px;
}
.navbar-default {
background-color: transparent;
}
Probrably it has to do with the vertical-align. try setting vertical-align:middle to .navbar .navbar-nav.
Edit: Usually that happens when you have elements with different vertical-align values. I don't know what are the CSS for the rest of your code but, having elementA with vertical-align:middle and elementB vertical-align:baseline.
Example:
.container{min-height:80px;width:100%;background:#333;}
.box1{background:#eee;width:40px;height:40px;display:inline-block;vertical-align:middle;}
.box2{background:red;width:100px;height:100px;display:inline-block;}
<div class="container">
<div class="box1"></div>
<div class="box2"></div>
</div>
Setting vertical-align:middle to .box2, will fix the problem.
I'm new to Bootstrap and I'm trying to center the navbar both horizontally and vertically so it looks something like this but I can't seem to figure it out.
Here's the html:
<html>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav" 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="nav">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Portfolio</li>
<li>Blog</li>
<li>Pages</li>
<li>Features</li>
<li>Mega menu</li>
<li>Contact</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
and CSS:
nav {
color: #fff;
height: 112px;
text-transform: uppercase;
font-size: 15px;
font-weight: bold;
}
If you want to center the links you need to apply those rules to the .navbar-nav and li classes (most likely you'll want these inside a media-query as well).
Centered Links CSS
#media (min-width: 768px) {
.navbar.navbar-default .navbar-nav {
width: 100%;
text-align: center;
}
.navbar.navbar-default .navbar-nav > li {
display: inline-block;
float: none
}
}
And you can use line-height to adjust the height of your links so they're vertically aligned.
Vertical Link Alignment
#media (min-width: 768px) {
.navbar.navbar-default .navbar-nav > li > a {
line-height: 4;
}
}
Working Example:
.navbar.navbar-default {
background: white;
border: 1px solid transparent
}
.navbar.navbar-default .navbar-nav.navbar-center > li > a,
.navbar.navbar-default .navbar-search > li > a {
color: #266080;
}
#media (max-width: 767px) {
.navbar.navbar-default {
padding: 15px 0;
}
.navbar.navbar-default .navbar-collapse {
margin-top: 15px;
margin-bottom: -15px;
border: 0;
box-shadow: none;
}
}
#media (min-width: 768px) {
.navbar.navbar-default {} .navbar.navbar-default .navbar-nav.navbar-center {
width: 100%;
text-align: center;
}
.navbar.navbar-default .navbar-nav.navbar-center > li {
display: inline-block;
float: none
}
.navbar.navbar-default .navbar-nav.navbar-center > li > a {
line-height: 4;
text-transform: uppercase;
font-size: 14px;
font-weight: bold;
}
.navbar.navbar-default .navbar-search {
position: absolute;
right: 2%;
top: 17px;
line-height: 4;
font-size: 20px;
}
}
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<nav class="navbar navbar-default navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav" 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="nav">
<ul class="nav navbar-nav navbar-center">
<li class="active">Home
</li>
<li>Portfolio
</li>
<li>Blog
</li>
<li>Pages
</li>
<li>Features
</li>
<li>Mega menu
</li>
<li>Contact
</li>
</ul>
<ul class="nav navbar-nav navbar-right navbar-search">
<li><span class="glyphicon glyphicon-search"></span>
</li>
</ul>
</div>
</div>
</nav>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
I am using navbar from Bootstrap3. There I just placed 2 links and social media icons. When the toggle-button is pressed I need to have the social media links content centered when the viewport is a smaller device like a phone or tablet. In my snippet the social links appeared to the left. Any help will be greatly appreciated.
<!-- Placed at the end of the document so the pages load faster -->
< script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" > < /script>
<!-- Latest compiled and minified JavaScript -->
<script src="https:/ / maxcdn.bootstrapcdn.com / bootstrap / 3.3.5 / js / bootstrap.min.js "></script>
/*css plugin for jquery content*/
.contenthover {
padding: 20px 20px 10px 20px;
}
.contenthover,
.contenthover h3,
contenthover a {
color: #fff;
}
.contenthover h3,
.contenthover p {
margin: 0 0 10px 0;
line-height: 1.4em;
padding: 0;
}
.contenthover a.mybutton {
display: block;
float: left;
padding: 5px 10px;
background: #3c9632;
color: #fff;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.contenthover a.mybutton:hover {
background: #34742d
}
/*website*/
body {
margin: 0px;
padding: 0px;
font-family: "Gotham SSm A", "Gotham SSm B", sans-serif;
font-weight: 300;
}
.navbar-text {
margin: 0px;
}
.navbar-text > i {
color: inherit;
text-decoration: none;
}
/****************modifying bootstrap***********************/
.navbar-default {
background-color: #fff;
margin-bottom: 0px;
}
#mylinks {
display: inline;
}
#centered li {
text-align: center;
}
.nav-pills {
padding-top: 5px;
margin-left: 0px;
}
#cont-socialmedia {
margin: 0px;
padding: 0px;
text-align: center;
}
#main_cont {
Padding-top: 15px;
Padding-bottom: 15px;
background-color: pink;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: blue;
/*Sets the text hover color on navbar*/
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: rgb(84, 5, 29);
/*BACKGROUND color for active*/
background-color: white;
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: gray;
/*Change rollover cell color here*/
}
.navbar-default .navbar-nav > li > a {
color: rgb(84, 5, 29);
/*Change active text color here*/
}
<head>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Social icons -->
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<!--toggle-->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#mylinks" 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>
<!--brand-->
<a class="navbar-brand" href="#">MILY VIDAL</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-right" id="mylinks">
<ul class="nav navbar-nav" id="centered">
<li class="active">Portfolio<span class="sr-only">(current)</span>
</li>
<li>Contact
</li>
</ul>
<!--testing new way to put smedia-->
<ul class="nav navbar-nav navbar-right nav-pills">
<li>
<i class="fa fa-linkedin"></i>
</li>
<li>
<a href="http://twitter.com/" class="btn btn-social-icon btn-twitter">
<i class="fa fa-twitter"></i>
</a>
</li>
<li>
<a href="http://www.linkedin.com/in/" class="btn btn-social-icon btn-linkedin">
<i class="fa fa-linkedin"></i>
</a>
</li>
<li>
<a href="https://github.com/broadmarkio" class="btn btn-social-icon btn-github">
<i class="fa fa-github"></i>
</a>
</li>
</ul>
<!--
<div class="navbar-text">
<a class="btn btn-social-icon" title="LinkedIn" href="#"><span><i class="fa fa-linkedin"></i></span></a>
<a class="btn btn-social-icon" title="JSFiddle" href="#"><span><i class="fa fa-jsfiddle"></i></span></a>
<a class="btn btn-social-icon" title="GitHub" href="#"><span><i class="fa fa-github"></i><span></a>
</div>
-->
<!--to delete
<li><a class="rssBtn smGlobalBtn" href="#" ></a></li>
<li><a class="linkedinBtn smGlobalBtn""></a></li>
-->
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!--navbar ends-->
</body>
Include the break-point 768px in the media-query. Set a width for the icons parent element for margin: 0 auto to work.
#media (max-width: 768px) {
#mylinks ul.nav.navbar-nav.navbar-right.nav-pills {
width: 200px;
margin: 0 auto;
}
}
<!-- Placed at the end of the document so the pages load faster -->
< script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" > < /script>
<!-- Latest compiled and minified JavaScript -->
<script src="https:/ / maxcdn.bootstrapcdn.com / bootstrap / 3.3.5 / js / bootstrap.min.js "></script>
/*css plugin for jquery content*/
.contenthover {
padding: 20px 20px 10px 20px;
}
.contenthover,
.contenthover h3,
contenthover a {
color: #fff;
}
.contenthover h3,
.contenthover p {
margin: 0 0 10px 0;
line-height: 1.4em;
padding: 0;
}
.contenthover a.mybutton {
display: block;
float: left;
padding: 5px 10px;
background: #3c9632;
color: #fff;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.contenthover a.mybutton:hover {
background: #34742d
}
/*website*/
body {
margin: 0px;
padding: 0px;
font-family: "Gotham SSm A", "Gotham SSm B", sans-serif;
font-weight: 300;
}
.navbar-text {
margin: 0px;
}
.navbar-text > i {
color: inherit;
text-decoration: none;
}
/****************modifying bootstrap***********************/
.navbar-default {
background-color: #fff;
margin-bottom: 0px;
}
#mylinks {
display: inline;
}
#centered li {
text-align: center;
}
.nav-pills {
padding-top: 5px;
margin-left: 0px;
}
#cont-socialmedia {
margin: 0px;
padding: 0px;
text-align: center;
}
#main_cont {
Padding-top: 15px;
Padding-bottom: 15px;
background-color: pink;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: blue;
/*Sets the text hover color on navbar*/
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: rgb(84, 5, 29);
/*BACKGROUND color for active*/
background-color: white;
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: gray;
/*Change rollover cell color here*/
}
.navbar-default .navbar-nav > li > a {
color: rgb(84, 5, 29);
/*Change active text color here*/
}
#media (max-width: 768px) {
div#mylinks ul.nav.navbar-nav.navbar-right.nav-pills {
width: 200px;
margin: 0 auto;
}
}
<head>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Social icons -->
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<!--toggle-->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#mylinks" 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>
<!--brand-->
<a class="navbar-brand" href="#">MILY VIDAL</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-right" id="mylinks">
<ul class="nav navbar-nav" id="centered">
<li class="active">Portfolio<span class="sr-only">(current)</span>
</li>
<li>Contact
</li>
</ul>
<!--testing new way to put smedia-->
<ul class="nav navbar-nav navbar-right nav-pills">
<li>
<i class="fa fa-linkedin"></i>
</li>
<li>
<a href="http://twitter.com/" class="btn btn-social-icon btn-twitter">
<i class="fa fa-twitter"></i>
</a>
</li>
<li>
<a href="http://www.linkedin.com/in/" class="btn btn-social-icon btn-linkedin">
<i class="fa fa-linkedin"></i>
</a>
</li>
<li>
<a href="https://github.com/broadmarkio" class="btn btn-social-icon btn-github">
<i class="fa fa-github"></i>
</a>
</li>
</ul>
<!--
<div class="navbar-text">
<a class="btn btn-social-icon" title="LinkedIn" href="#"><span><i class="fa fa-linkedin"></i></span></a>
<a class="btn btn-social-icon" title="JSFiddle" href="#"><span><i class="fa fa-jsfiddle"></i></span></a>
<a class="btn btn-social-icon" title="GitHub" href="#"><span><i class="fa fa-github"></i><span></a>
</div>
-->
<!--to delete
<li><a class="rssBtn smGlobalBtn" href="#" ></a></li>
<li><a class="linkedinBtn smGlobalBtn""></a></li>
-->
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!--navbar ends-->
</body>
I am trying to create a nav bar (boot strap) that sticks to the top once scrolled down past through it. I was able to achieve this behavior using affix plugin, but with a glitch. The nav bar is creating certain amount of right margin on scrolling down. I am unable to resolve the issue. Please help me resolve this.
This is my html code for nav bar
$(function () {
$('#nav-wrapper').height($("#nav").height());
$('#nav').affix({
offset: {
top: $('#nav').offset().top
}
});
});
.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
.navbar .navbar-collapse {
text-align: center;
}
#media (min-width: 768px) {
.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
.navbar .navbar-collapse {
text-align: center;
}
}
#media (min-width: 768px) {
.navbar {
border-radius: 15
}
}
.navbar-toggle {
border-radius: 15
}
.navbar-toggle .icon-bar {
border-radius: 0
}
.navbar {
background: #700000;
margin-bottom: auto;
border-color: #384248;
width: 100%;
}
#media (min-width: 768px) {
.navbar-nav > li > a {
padding-top: 17px;
padding-bottom: 17px;
}
}
#nav.affix {
position: fixed;
top: 0;
width: 100%;
margin: 0px;
-webkit-transition: all .6s ease-in-out;
}
#nav > .navbar-inner {
border-left: 0;
border-right: 0;
border-radius: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
-o-border-radius: 0;
}
/* To simulate overflow for demo purposes only */
html { height: 200%; } body { height: 100%; }
<!-- External Resources -->
<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.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<!-- External Resources -->
<!-- Nav Bar Section -->
<div id="nav-wrapper">
<div class = "row" id="nav-row">
<nav class="navbar navbar-inverse navbar-static-top" id = "nav" role="navigation">
<div class = "container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavBar">
<!--<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 visible-xs" href="index_hth.html">Navigation</a>
</div> <!-- end navbar-header div-->
<div class="collapse navbar-collapse" id = "myNavBar">
<ul class="nav navbar-nav" id="menu-bar">
<li>Home</li>
<li>Offers</li>
<li>About Us</li>
<li>Contact Us</li>
</ul>
</div> <!-- end collapse div -->
</div><!-- end container-fluid-->
</nav> <!-- end nav -->
</div>
</div>
<!-- Nav Bar Section End-->
Please look into this and help me resolve the issue. Thanks in advance.
Using the code inspector I found that #nav-wrapper .row#nav-row has a negative margin set.
The rule of specificity and margin: 0 fixes the issue
#nav-wrapper .row#nav-row {
margin: 0;
}
$(function () {
$('#nav-wrapper').height($("#nav").height());
$('#nav').affix({
offset: {
top: $('#nav').offset().top
}
});
});
#nav-wrapper .row#nav-row {
margin: 0;
}
.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
.navbar .navbar-collapse {
text-align: center;
}
#media (min-width: 768px) {
.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
.navbar .navbar-collapse {
text-align: center;
}
}
#media (min-width: 768px) {
.navbar {
border-radius: 15
}
}
.navbar-toggle {
border-radius: 15
}
.navbar-toggle .icon-bar {
border-radius: 0
}
.navbar {
background: #700000;
margin-bottom: auto;
border-color: #384248;
width: 100%;
}
#media (min-width: 768px) {
.navbar-nav > li > a {
padding-top: 17px;
padding-bottom: 17px;
}
}
#nav.affix {
position: fixed;
top: 0;
width: 100%;
margin: 0px;
-webkit-transition: all .6s ease-in-out;
}
#nav > .navbar-inner {
border-left: 0;
border-right: 0;
border-radius: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
-o-border-radius: 0;
}
/* To simulate overflow for demo purposes only */
html { height: 200%; } body { height: 100%; }
<!-- External Resources -->
<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.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<!-- External Resources -->
<!-- Nav Bar Section -->
<div id="nav-wrapper">
<div class = "row" id="nav-row">
<nav class="navbar navbar-inverse navbar-static-top" id = "nav" role="navigation">
<div class = "container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavBar">
<!--<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 visible-xs" href="index_hth.html">Navigation</a>
</div> <!-- end navbar-header div-->
<div class="collapse navbar-collapse" id = "myNavBar">
<ul class="nav navbar-nav" id="menu-bar">
<li>Home</li>
<li>Offers</li>
<li>About Us</li>
<li>Contact Us</li>
</ul>
</div> <!-- end collapse div -->
</div><!-- end container-fluid-->
</nav> <!-- end nav -->
</div>
</div>
<!-- Nav Bar Section End-->
I have an issue with Bootstrap 3. I don't know why, but in mobile screen there is space between navbar-brand and navigation bar ending. I guess, it is because of navigation bar glyphicon doesn't fit my navigation bar. How can I solve this issue? I just need to remove that empty space...
Desktop-size version:
Mobile-size version:
HTML:
<header class="top" role="header">
<div class="container">
<a href="../aplikacija/app.html" class="navbar-brand pull-left">
Brand
</a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="glyphicon glyphicon-align-justify"></span>
</button>
<nav class="navbar-collapse collapse" role="navigation">
<ul class="navbar-nav nav">
<li>Page 1</li>
<li>Page 2</li>
</ul>
</nav>
</div>
</header>
CSS:
div.container {
background-color: #474747;
display: block;
width: 80%;
height: auto;
margin-left: auto;
margin-right: auto;
padding-left: 0px;
}
a.navbar-brand {
text-shadow: none;
background-color: #ccc;
color: #474747;
margin-left: 0px;
}
ul.navbar-nav li a{
text-shadow: none;
color: #ccc;
}
ul.navbar-nav li a:hover {
background-color: #373737;
color: #ccc
}
button.navbar-toggle {
color: #ffffff;
}
span.glyphicon {
color: #009B9B;
}
You can remove this space by removing the margin-bottom from the .navbar-toggle:
button.navbar-toggle {
color: #ffffff;
margin-bottom: 0px !important;
}
!important is optional, i can't tell you right now if you need this, just test it.