Bootstrap navbar-toggle is not at the top - html

So I have this issue, I'm trying to get the navbar-toggle to get up into the corner but it's over lapping.
I also have a icon in pc view that over lapping which I really like.
Is there a way to fix the navbar-toggle??
My code is below.
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top">
<img class="visible-xs img-rounded pull-right" src="smallicon2.png" alt="" >
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-brand page-scroll">
<button type="button" class="navbar-toggle pull-left" 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>
<img src="icon2.png" class="img-rounded hidden-xs" />
</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 class="hidden">
</li>
<li>
<a class="page-scroll" href="#">Home</a>
</li>
<li>
<a class="page-scroll" href="#services">Services</a>
</li>
<li>
<a class="page-scroll" href="#portfolio">Portfolio</a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
Thanks for looking.

In bootstrap CSS, Following causing the issue padding: 15px;
.navbar-brand {
float: left;
height: 50px;
padding: 15px;
font-size: 18px;
line-height: 20px;
}
This may fix the issue padding: 0px 15px; but it will effect the logo too
.navbar-brand {
float: left;
height: 50px;
padding: 0px 15px;
font-size: 18px;
line-height: 20px;
}
Fiddle
Proper Fix without effecting the logo, change margin-top: 8px; to margin-top: -5px; to following CSS in bootstrap css file
.navbar-toggle {
position: relative;
float: right;
padding: 9px 10px;
margin-top: -5px; <<<< Here
margin-right: 15px;
margin-bottom: 8px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
Fiddle
Note: Better approach do not edit bootstrap css, make customstyle.css and add above css with !important rule in custom css.

Don't waste your time with fixing. Copy and paste the complete navbar from Bootstrap navbar. After that, delete HTML you don't need, correctly!
The problem often begins if you want to have a navbar with a bigger logo.
Here is a precise instruction how to create a Bootstrap navbar with a bigger logo.

Related

How to make the bottom part of 2 divs align

Im currently trying to make the bottom of two divs, a title and a navbar, to line up vertically, but I'm having a bit of trouble figuring out how to make that work. vertical-align:bottom in the CSS doesn't seem to work. To clarify, I want the "GOT/IT" text and the nav bar text elements to line up vertically (bottom). The code is shown here:
.navbar-default {
padding-top: 65px;
padding-left: 45px;
padding-right: 45px;
margin-left: 0px;
margin-right: 0px;
border-radius: 0px;
border-bottom: 10px solid #2e9eed;
}
.header-text {
font-size: 64px;
color: blue;
position: relative;
padding-bottom: 20%;
}
.header-item-text {
background-color: green;
font-size: 20px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<nav class="navbar navbar-default">
<!-- 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="#"><span class = "header-text">GOT/IT</span></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<!-- Desktop + Tablet View -->
<div class="hidden-xs">
<div class="pull-right collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="header-item-text">THE WHY
</li>
<li class="header-item-text">THE WHAT
</li>
<li class="header-item-text">VALIDATE
</li>
<li class="header-item-text">ABOUT
</li>
<li class="header-item-text">CONTACT
</li>
</ul>
</div>
</div>
</nav>
</div>
</div>
I am assuming you are trying to vertically align the bottom of two columns. You can try using a table for this like the following:
<table >
<tr>
<td style="vertical-align:bottom">
<div>
....
....
</div>
</td>
<td style="vertical-align:bottom">
<div>
....
....
</div>
</td>
</tr>
</table>
You can give equal padding-left to both div.
I would suggest use bootstrap CSS.
You can also use HTML table tags.

Add an oversized logo image to a fixed bottom navbar in bootstrap

I am trying to add a logo as the brand on a fixed-bottom navbar.
The logo is larger than the navbar itself. I want it to overlap the body, but instead it hangs below the top of the links.
I don't know what element to style in to change.
.navbar {
height:72px;
background: transparent;
background-image: url("../images/nav-bkgd.png");
background-repeat: repeat-x;
border: 0;
text-transform: uppercase;
font-family: "Bangers","Helvetica Neue",Helvetica,Arial,sans-serif;
letter-spacing: 2px;
padding-left: 35px;
padding-right: 35px;
}
.navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
}
.navbar-fixed-bottom {
font-size: 2em;
-webkit-transition: all .3s;
-moz-transition: all .3s;
transition: all .3s;
}
<body>
<div class="container">
<div class="navbar-header page-scroll">
<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>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><img src='assets/images/logo.png'</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a class="page-scroll" href="#">TROPOSHPERE</a>
</li>
<li>
<a class="page-scroll" href="#">STRATOSPHERE</a>
</li>
<li>
<a class="page-scroll" href="#">MESOSPHERE</a>
</li>
<li>
<a class="page-scroll" href="#">THERMOSPHERE</a>
</li>
<li>
<a class="page-scroll" href="#">EXOSPHERE</a>
</li>
</ul>
</div>
</div>
</nav>
try
.navbar-brand img {
margin-top: -16px;
}
I just put -16px as a random measurement but tweak it to match what you want of course.
Also the img tag within the link isn't closed (missing />)

Bootstrap 3 Navbar menu item alignment

Site : http://www.Spotlightdd.co.uk
I have a navbar that has an increased size due to the logo in the middle. The logo has a -margin value to line it up with the bottom border (I know it's out by a few px). What i'm trying to do is move the text down without just increasing the size of the navbar, so it looks more centered in the navbar. Currently, i've tried using margin/padding.line-height, anything i can think of that would only move the text to no avail. If someone could try a hand at sorting it, that would be brilliant.
Thanks
(Navbar html)
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img alt="CompanyLogo" src="img/spotlightLogo.png" style = "height: 80px" >
</a>
<button type="button" class="navbar-toggle collapsed" 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>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav nav-center">
<li> HOME </li>
<li> WEB DESIGN</li>
<li> GRAPHIC DESIGN </li>
<li> SOCIAL MEDIA </li>
<li class = "logo"> <img src = "img/spotlightLogo.png" class = "headerLogo img-responsive" alt = "spotlight" style = "height: 150px;"></li>
<li> PRINTING </li>
<li class="active"> BRANDING </li>
<li> VIDEO PRODUCTION </li>
<li> CONTACT </li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
(Navbar CSS)
.navbar-default {
border-bottom: 3px solid #CE1344;
background-image: none;
background-color: white;
}
.navbar .navbar-nav {
text-align: center;
display: inline-block;
float: none;
vertical-align: top;
}
li > a {
margin-top: 0px;
}
.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
.navbar .navbar-collapse {
text-align: center;
}
.headerLogo {
margin-bottom: -50px;
}
I tried to put in every bit of code relevant. Apologies because the css file is a mess at the moment.
Try adding this to your css:
.navbar-nav>li{
padding: 20px 0;
}
.navbar-nav>li.logo{
padding: 0
};
This should do the trick.
Try this:
.nav-center{
position: relative;
top: 20px;
}
li.logo {
position: relative;
bottom: 22px;
}

Bootstrap 3 Navbar Mobile Issue

I am having trouble getting bootstrap 3's navabar to be responsive on a mobile device. The navbar continues to span further than the mobile display, and I cannot figure out what I did wrong.
The Code:
(HTML)
<nav class="navbar navbar-inverse navbar-fixed-top" 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="#navigationbar">
<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 img-responsive" href="index.html">
<img src="img/logo.png" width="320" height="85" alt="">
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navigationbar">
<ul class="nav navbar-nav navbar-right">
<li>
Home
</li>
<li>
Getting Started
</li>
<li class="dropdown">
Products <b class="caret"></b>
<ul class="dropdown-menu">
<li>
Brain Seedâ„¢
</li>
</ul>
</li>
<li>
About Us
</li>
<li>
FAQ
</li>
<li>
Contact Us
</li>
<li>
<button type="button pull-right" class="btn btn-success">ORDER NOW</button>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
The Code: (CSS)
.navbar-fixed-top .nav {
padding: 20px 0;
}
.navbar-fixed-top .navbar-brand {
padding: 0 15px;
}
.page-content {
padding-top: 40px;
}
.img-center {
display: block;
margin: 0 auto;
}
.navbar .brand {
max-height: 40px;
max-width: 30%;
overflow: visible;
padding-top: 0;
padding-bottom: 0;
}
I notice you in your html code, you typed fixed height and width, which cancels the img-responsive class.
Start by removing that and go from there...enter link description here

How do I align a Logo next to navigation links that are horizontally centered?

I've been struggling the last several hours with positioning my logo just to the right of the centered navigation links in a responsive Navbar. Tried dozens of ways to get this to work without any luck. I left most of the CSS for the Navbar intact; BootStrap 3. Any assistance would be greatly
appreciated! Link to site is:
Many Thanks!
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Fixed navbar -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<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="indexalt.html">
<img src="data2/test5.png" width="61" height="48">
</a>
<div class="navbar-text"> <span class="FutureFont">Future Youth <span style="color:#ee1b04; font-size: 16px;">R</span>ecords</span>
</div>
</div>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li>
NEWS
</li>
<li class="dropdown">
ABOUT US
<ul class="dropdown-menu">
<li>Our Team
</li>
<li>Mission
</li>
<li>Contact
</li>
</ul>
</li>
<li>PROJECTS
</li>
<li class="dropdown">
MEDIA
<ul class="dropdown-menu">
<li>Audio
</li>
<li>Video
</li>
<li>Photos
</li>
<li>Enter Download Code
</li>
</ul>
</li>
<li>DONATE
</li>
</ul>
</span>
<div class="sociallinks pull-right">
<a href="">
<img id="aks" src="data2/FB1.png" width="32" height="32">
</a>
<a href="">
<img id="akst" src="data2/Twitter1.png" width="32" height="32">
</a>
<a href="">
<img id="aksy" src="data2/youtube1.png" width="32" height="32">
</a>
</span>
</div>
</div>
<!--/.nav-collapse -->
</div>
</nav>
Your html had unclosed divs, extra divs, wrong classes, and lots of issues. It's best to follow examples on the GetBootstrap.com to the letter and comment and indent your code. When you have a problem that requires getting help, always make an effort to use clean, valid, html with following the documentation.
The .navbar for Bootstrap is very specific, it's left or right and that's it. You have to understand CSS and positioning etc., to change it around. And you also have to be adept at responsive CSS and become very fluent with the Bootstrap CSS as well.
This is not the finished product. The height of the navbar in this situation is dependent on the height of the tallest child, the logo. The logo is 60px tall with 10px padding on the top and bottom, 80px line-height on the first child of the links is used to make it center inside there. Otherwise there would be a lot more CSS to create.
DEMO: https://jsbin.com/tupay/1/
https://jsbin.com/tupay/1/edit?html,css,output
HTML:
<!-- Fixed navbar -->
<nav class="navbar-center navbar-inverse navbar-fixed-top" role="navigation" id="nav">
<div class="container">
<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="logo" href="indexalt.html">
<img src="http://placehold.it/60x60/ffffff/000000&text=LOGO">
</a>
<div id="navbar" class="my-collapse collapse">
<ul class="navbar-center navbar-nav nav">
<li>
NEWS
</li>
<li class="dropdown">
ABOUT US <span class="caret"></span>
<ul class="dropdown-menu">
<li>Our Team
</li>
<li>Mission
</li>
<li>Contact
</li>
</ul>
<!--/.dropdown-menu -->
</li>
<li>PROJECTS</li>
<li class="dropdown">
MEDIA <span class="caret"></span>
<ul class="dropdown-menu">
<li>Audio
</li>
<li>Video
</li>
<li>Photos
</li>
<li>Enter Download Code
</li>
</ul>
<!--/.dropdown-menu -->
</li>
<li>DONATE
</li>
</ul>
<!-- /ul.navbar-center -->
</div>
<!--/.my-collapse collapse -->
<div class="social-links clearfix">
<a href="#">
<img src="http://placehold.it/64x64/ffffff/000000&text=X">
</a>
<a href="#">
<img src="http://placehold.it/64x64/ffffff/000000&text=X">
</a>
<a href="#">
<img src="http://placehold.it/64x64/ffffff/000000&text=X">
</a>
</div>
<!--/.social-links -->
</div>
<!--/.container -->
</nav>
<!-- /nav.navbar-center -->
CSS
nav.navbar-center.navbar-inverse {
background: #000
}
.navbar-center .social-links a {
width: 32px;
height: 32px;
float: left;
padding-right: 5px;
}
nav.navbar-center .social-links {
float: left;
padding: 27px 0 10px 0;
}
nav.navbar-center img {
max-width: 100%;
height: auto;
}
nav.navbar-center .logo {
float: left;
padding: 10px 20px 10px 0;
}
.navbar-inverse button.navbar-toggle {
margin: 0;
border: none;
border-radius: 0;
padding: 10px;
width: 50px;
height: 80px;
}
.navbar-inverse button.navbar-toggle .icon-bar {
width: 100%;
display: block;
margin: 5px 0;
height: 3px;
border-radius: 0;
background:#fff;
border:0px;
padding: 0;
}
#media (max-width:767px) {
nav.navbar-center .my-collapse {
clear: both;
padding: 10px 0;
}
}
#media (min-width:768px) {
nav.navbar-center img {
width: 100%;
height: auto;
}
nav.navbar-center .container {
text-align: center;
max-width: 980px;
}
#navbar.my-collapse.collapse {
visibility: visible;
display: inline-block;
}
ul.navbar-center > li > a {
padding: 0 15px;
line-height: 80px;
}
nav.navbar-center .logo {
padding: 10px 0 10px 0;
text-align: left;
float: left;
}
nav.navbar-center .social-links {
line-height: 80px;
float: right;
padding: 0;
}
}