How to center vertically menu items on nav bar? - html

I try to center vertically menu items "TEST 1","TEST 2" and "BRAND" without successful.
I have tried vertical-align,margin-top and bottom.
I mean, I don't want to put one on top of another, just center between margin top and bottom of the nav bar.
I really appreciate if somebody can help me.
HTML
<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="#menu-collapse" 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
</div>
<div class="collapse navbar-collapse" id="menu-collapse">
<ul class="nav navbar-nav navbar-center">
<li><a id="menu-right" href="#">TEST 1</a></li>
<li><a id="menu-right" href="#">TEST 2</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><button class="btn btn-primary">Start Now</button></li>
<li><button class="btn btn-primary">Member Login </button>
</li>
</ul>
</div>
</div>
</nav>
CSS
#menu-right:hover {
background: #5d5dc9;
color:#fff;
}
#menu-right {
color:#337ab7;
text-transform: uppercase;
vertical-align: middle;
}
ul {
vertical-align: middle;
}
.button-margin {
border: 1px solid;
}
.navbar-brand {
margin-right: 200px;
}
.navbar {
margin-bottom: 0;
font-family: 'Raleway', sans-serif;
font-size: 1.5em;
font-weight: 800;
text-transform: uppercase;
}
Here is a link to codepen website test : https://codepen.io/fdcoder81/pen/Kymyyj
Thank you very much

If you set the line-height of your a tags to the height of the navbar it should be aligned vertically centered.
Btw both of your:
<a id="menu-right" href="#">
occurences should have classes - you can't have the same id assigned more than one element.
Take
<a class="menu-right" href="#">
And change in your css accordingly to
.menu-right
EDIT:
I played around with your codepen stuff - I don't know if that's the way to go when using bootstrap but it works.
Your HTML:
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TEST</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,900" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Raleway:400,800" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<header>
<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="#menu-collapse" 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
</div>
<div class="collapse navbar-collapse" id="menu-collapse">
<ul class="nav navbar-nav navbar-center">
<li>
<a class="menu-right" href="#">TEST 1</a>
</li>
<li>
<a class="menu-right" href="#">TEST 2</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#">
<button class="btn btn-primary">Start Now</button>
</a>
</li>
<li>
<a href="#">
<button class="btn btn-primary">Member Login </button>
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!--<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>-->
</body>
</html>
Your CSS:
.menu-right:hover {
background: #5d5dc9;
color: white;
}
.menu-right {
color:#337ab7;
text-transform: uppercase;
line-height: 54px;
}
.button-margin {
border: 1px solid;
}
.navbar > .container-fluid .navbar-brand {
margin-right: 200px;
line-height: 54px;
padding-top: 0;
padding-bottom: 0;
}
.navbar {
margin-bottom: 0;
font-family: 'Raleway', sans-serif;
font-size: 1.5em;
font-weight: 800;
text-transform: uppercase;
}
.navbar-default .navbar-nav>li>a {
line-height: 54px;
padding-top: 0;
padding-bottom: 0;
}

Related

navbar Toggle in bootstrap is not working

I am trying to work on twitter bootstrap to make a responsive website although i am facing some problem with the navigation toggle button I have included all the libraries which was the issue for some of the questions asked here still I am unable to know the exact problem.
body {
font-family: Arial, serif;
background: url(https://freenaturestock.s3.us-east-1.amazonaws.com/1602.jpg) center center no-repeat;
background-attachment: fixed;
background-size: cover;
}
/* editing the logo part*/
.logo {
height: 32px;
opacity: 1;
}
/* editing the navbar background colour*/
.navbar-inverse {
background: rgba(0, 0, 0, 0.5);
}
/* navbar list options editing*/
.nav li {
color: #fff;
font-size: 17px;
margin-right: 15px;
padding: 10px 15px;
}
.nav li:hover {
border-bottom: 3px solid #00FFB8;
padding-bottom: 3px;
}
<!DOCTYPE html>
<html lang="en">
<head>
< meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>WebServ</title>
<link href="https://fonts.googleapis.com/css2?family=Arvo:ital,wght#0,400;0,700;1,400&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js" integrity="sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ=" crossorigin="anonymous"></script>
<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://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="styling.css">
</head>
<body data-spy="scroll" data-target=".navbar" data-offset="30">
<!-- Create a nav bar-->
<div class="container-fluid">
<nav role="navigation" class="navbar nav-tabs navbar-inverse bg-inverse navbar-toggleable navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar" aria-controls="myNavbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="sr-only">Toggle navigation</span>
<!-- <span class="navbar-toggler-icon"></span>-->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Logo</a>
</div>
<div class=" collapse navbar-collapse" id="myNavbar ">
<ul class=" nav navbar-nav navbar-right mylist">
<li class="nav-item" role="presentation"><a class="nav-link" href="#home"><span class="glyphicon glyphicon-home" style="padding: 8px;"></span>Home</a></li>
<li class="nav-item" role="presentation" " ><a class="nav-link " href="#about "><span class="glyphicon glyphicon-user " style="padding: 8px " ;></span>About</a>
</li>
<li class="nav-item " role="presentation "><a class="nav-link " href="#portfolio "><span class="glyphicon glyphicon-list-alt " style="padding: 8px; "></span>Portfolio</a></li>
<li class="nav-item " href="#role=" presentation "><a class="nav-link " href="#contact "><span class="glyphicon glyphicon-earphone " style="padding: 8px; "></span>Contact</a></li>
</ul>
</div>
</div>
</nav>
</div>
</body>
</html>
https://codepen.io/webserv01/pen/rNxKVrN
you had two problems, the first in id of navbar, you include a space:
id="myNavbar ">
Must be : id="myNavbar">
the second problem was you include old jquery release(with a bug, and two time?)
body {
font-family: Arial, serif;
background: url(https://freenaturestock.s3.us-east-1.amazonaws.com/1602.jpg) center center no-repeat;
background-attachment: fixed;
background-size: cover;
}
/* editing the logo part*/
.logo {
height: 32px;
opacity: 1;
}
/* editing the navbar background colour*/
.navbar-inverse {
background: rgba(0, 0, 0, 0.5);
}
/* navbar list options editing*/
.nav li {
color: #fff;
font-size: 17px;
margin-right: 15px;
padding: 10px 15px;
}
.nav li:hover {
border-bottom: 3px solid #00FFB8;
padding-bottom: 3px;
}
<link href="https://fonts.googleapis.com/css2?family=Arvo:ital,wght#0,400;0,700;1,400&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.5.1.js" integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
<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://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<body data-spy="scroll" data-target=".navbar" data-offset="30">
<!-- Create a nav bar-->
<div class="container-fluid">
<nav role="navigation" class="navbar nav-tabs navbar-inverse bg-inverse navbar-toggleable navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar" aria-controls="myNavbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="sr-only">Toggle navigation</span>
<!-- <span class="navbar-toggler-icon"></span>-->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Logo</a>
</div>
<div class=" collapse navbar-collapse" id="myNavbar">
<ul class=" nav navbar-nav navbar-right mylist">
<li class="nav-item" role="presentation"><a class="nav-link" href="#home"><span class="glyphicon glyphicon-home" style="padding: 8px;"></span>Home</a></li>
<li class="nav-item" role="presentation" " ><a class="nav-link " href="#about "><span class="glyphicon glyphicon-user " style="padding: 8px " ;></span>About</a>
</li>
<li class="nav-item " role="presentation "><a class="nav-link " href="#portfolio "><span class="glyphicon glyphicon-list-alt " style="padding: 8px; "></span>Portfolio</a></li>
<li class="nav-item " href="#role=" presentation "><a class="nav-link " href="#contact "><span class="glyphicon glyphicon-earphone " style="padding: 8px; "></span>Contact</a></li>
</ul>
</div>
</div>
</nav>
</div>
</body>

Creating a Full screen Overlay Navigation

I am trying to get a full screen navigation overlay to work on iPad sizes etc. I'm using bootstrap 3, and what I want is when the user gets the burger menu, and they click it, it will cause a full screen overlay such as this example:
Here Link
I for some reason cant get it to work on my code and I am wondering if its because of my bootstrap classes or what?
HTML:
<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>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-default navbar-fixed-top " id="section1">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle" data-target="#myNavbar" data-toggle="collapse" type="button">
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand"><img alt="" src="Images/logo.png" class="img-responsive"></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li>
Home
</li>
<li>
About Me
</li>
<li>
Skills
</li>
<li>
Me
</li>
<li>
Hobbies
</li>
<li>
Contact Me
</li>
</ul>
</div>
</div>
</nav>
I was wondering if anyone can help me get this to work when it goes to iPad sizes on 768 screens.
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.css">
<link href="css/style.css" rel="stylesheet">
<style>
.overlay {
width: 100%;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: rgb(0, 0, 0);
background-color: rgba(0, 0, 0, 0.9);
overflow-y: hidden;
transition: 0.5s;
}
.overlay-content {
position: relative;
top: 25%;
width: 100%;
text-align: center;
margin-top: 30px;
}
.overlay a {
padding: 8px;
text-decoration: none;
font-size: 36px;
color: #818181;
display: block;
transition: 0.3s;
}
.overlay a:hover,
.overlay a:focus {
color: #f1f1f1;
}
.overlay .closebtn {
position: absolute;
top: 20px;
right: 45px;
font-size: 60px;
}
</style>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top " id="section1">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle" data-target="#myNavbar" data-toggle="collapse" type="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand">
<img alt="" src="Images/logo.png" class="img-responsive">
</a>
</div>
<div class="collapse navbar-collapse overlay" id="myNavbar">
×
<ul class="nav navbar-nav navbar-right overlay-content">
<li>
Home
</li>
<li>
About Me
</li>
<li>
Skills
</li>
<li>
Me
</li>
<li>
Hobbies
</li>
<li>
Contact Me
</li>
</ul>
</div>
</div>
</nav>
<script src="js/jquery-2.2.3.min.js"></script>
<script src="js/bootstrap.js"></script>
<script>
$("button").on("click", function () {
$("#myNavbar").css("height", "100%");
});
$("#myNavbar a").on("click", function () {
$("#myNavbar").css("height", "0%");
})
</script>
</body>
</html>
Try this saving as a HTML File and link bootstrap files properly. The thing you were missing was overlays. I used the same overlays from your link.

how can I make a background image take the whole width of the screen in Bootstrap?

I was using Bootstrap to create my first website, however the background image in Jumbotron div does not fill the whole width of the screen leaving a narrow margin on both sides, I have tried changing padding, margins, and change width of the div to 100% but it didn't work.
body {
background-color: #ffe6e6;
}
.navbarheight {
height: 60px;
}
#myname {
margin-left: 0px;
font-size: 45px;
}
.allnavicons {
margin-right: 50px;
}
.navicon {
font-size: 25px;
margin-right: 30px;
}
.jumbotron {
width: 100%;
background-image: url("https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQ-H9Giy0rTSpFwziVBPYtGvAPNcDjSTbQpZDJvVV2vXQ6DClHdOQ")
}
#welcome {
text-align: center;
padding-top: 30px;
}
</style>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link href='https://fonts.googleapis.com/css?family=Arvo' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container-fluid">
<!--Navbar start........................-->
<nav class="navbar navbar-inverse navbar-fixed-top navbarheight">
<div class="container-fluid">
<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"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#" id="myname">Mohamed Hegazy</a>
</div>
<div id="navbar" class="collapse navbar-collapse navbar-right">
<ul class="nav navbar-nav allnavicons">
<li class="active navicon">About
</li>
<li>Portfolio
</li>
<li>Contact
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</nav>
<!--Navbar end..........................-->
<!--jumbotron container start..........................-->
<div class="jumbotron">
<div class="container">
<h1 id="welcome">Welcome to my Portfolio!</h1>
<p></p>
<p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more »</a>
</p>
</div>
</div>
<!--jumbotron container end..........................-->
</body>
</html>
add this to your CSS code :
.container-fluid{
padding:0;
}

Align Bootstrap navBar in one line

I made a navBar with Bootstrap which looks different on different resolutions. If the screen gets smaller it looks like this:
Picture 1:
Picture 2:
Picture 3:
Pciture 1 and 2 are fine, this is how I want it to be. But in picture 3 everything would fit in two lines but it is split into three lines. I need to have everything in two lines. I tried to play around with the css but I could not solve it. This is my code:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js" integrity="sha384-mXQoED/lFIuocc//nss8aJOIrz7X7XruhR6bO+sGceiSyMELoVdZkN7F0oYwcFH+" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity = "sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity = "sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity = "sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous" />
<link rel="stylesheet" href="css/design.css" />
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navBar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="visible-xs navbar-brand">Startseite</span>
</div>
<div class="navbar-collapse collapse" id="navBar">
<ul class="nav navbar-nav navInline">
<li class="hidden-xs">Startseite</li>
<li>Telefonliste ABC</li>
<li>Telefonliste ABC</li>
<li>Telefonliste ABC</li>
<li>Telefonliste ABC</li>
<li>Telefonliste ABC</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Administration<span class="caret" style="padding-left:0px;"></span></a>
<ul class="dropdown-menu">
<li>Stuff</li>
<li>Stuff</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<div class="trennlinie visible-xs"></div>
<li class="navLi"><span class="navLiInner" id="clock">01.01.1970 - 00:00:00</span></li>
<li class="navLi"><span class="navLiInner">NAME (TODO)</span></li>
<li><span class="glyphicon glyphicon-log-in"></span> Logout</li>
</ul>
</div>
</div>
</nav>
</body>
</html>
CSS:
.nav > li > .navBarItem
{
padding-left: 8px;
padding-right: 8px;
}
.navBarItem:focus
{
outline: none;
}
.navLi
{
padding:15px;
}
.navLiInner
{
color: #9D9D9D;
text-shadow: 0px -1px 0px rgba(0,0,0,.25)
}
.navInline
{
display: inline;
}
.trennlinie
{
border-bottom: 1px solid #383838;
box-shadow: 0px -1px 0px 0px #000000;
margin-top: 4px;
margin-bottom: 4px;
}
I appreciate any kind of help.
Kind regards :)
Reduce font-size and padding and it should fits like this
.nav > li > .navBarItem
{
padding-left: 4px;
padding-right: 4px;
font-size: 12px;
}

Logo in navbar, spacing above the navigation list, and below the logo

I have been trying to code a responsive header using Bootstrap 3, I just have one.
There is a space above the navigation list, and below the logo as well.
How can I line up the two of them? (logo&nav)
Picture of my header which explains the problem:
My code:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/custom4.css">
<script src="js/respond.js"></script>
</head>
<body>
<div class="row">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<img src="img/logo.png" alt="logo" class="visible-xs">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#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 class="container">
<div class="collapse navbar-collapse" id="collapse">
<img src="img/logo.png" alt="logo" class="hidden-xs push-left">
<ul class="nav navbar-nav pull-right">
<li>Home</li>
<li>pages</li>
<li>Blog</li>
<li>Portfilio</li>
<li>Conact</li>
</ul>
</div>
</div>
</nav>
</div>
<!-- Javasctipt -->
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
Structurally your html differs than my approach and from the docs on bootstrap for the navbar implementation. You put .row around col-* classes. You don't need to duplicate the logo for small and large, if it's the same image. You can also just modify the brand and positioning in the min-width. Don't know your logo widths, but you can easily adjust in the min-width what you need and, also in the min-width, adjust the padding on the parent a so that it visually is in line with the logo.
DEMO: http://jsbin.com/aXAyicIS/1/
EDIT: http://jsbin.com/aXAyicIS/1/edit
CSS
.navbar-brand {
width: 100%;
padding: 0 70px 0 15px;
}
/* logo image on mobile */
.navbar-brand img {
max-width: 100%
}
.navbar-toggle {
position: absolute;
float: none;
right: 0;
top: 5px;
}
#media (min-width:768px) {
.navbar-brand {
float: none;
width: auto;
max-height: none;
padding: 0!important;
}
.navbar-header {
float: left;
margin: 0;
width: 30%;
}
/* logo image */
.navbar-brand img {
margin: 0;
max-width: 100%;
max-height: none;
}
.nav.navbar-nav li.active a,
.nav.navbar-nav li.active a:hover {
background: transparent
}
#nav-collapse {
float: right;
padding: 0!important;
margin: 0!important;
width: 70%;
}
}
HTML
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
<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>
<img src="http://placehold.it/300x80/444444/FFFFFF&text=LOGO">
</div>
<div id="nav-collapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active">Anchor 1</li>
<li>Anchor 2</li>
<li>Anchor 3</li>
<li class="dropdown"> Dropdown <b class="caret"></b>
<ul class="dropdown-menu">
<li>Test</li>
<li>Another link</li>
<li>Something else here</li>
<li class="divider"></li>
<li class="dropdown-header">Nav header</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container -->
</div>
<!--.navbar-->