Bootstrap logo over fixed navbar - html

I am trying to push the navbar line (and obviously the content as well) down according to logo height. Here is my HTML code:
<div class="navbar navbar-default navbar-fixed-top custom-header" role="navigation">
<div class="container">
<div class="navbar-header transparent">
<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>
<a class="navbar-brand" href="#"><img src="images/logoSmall.png" alt="Page Logo"> Brand Title</a>
<div class="row">
<div class="col-lg-12 custom-navbar-line">
<div class="collapse navbar-collapse">
<ul class="nav nav-pills custom-nav-pills">
<li class="active"><a ng-href="#">Home</a></li>
<li><a ng-href="#">Page1</a></li>
<li><a ng-href="#">Page2</a></li>
<li><a ng-href="#">Page3</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
What I want:
What I get:
Note: Custom css classes have not much to do with the positioning.

You may try something like this:
HTML:
<a class="navbar-brand" href="#"><img src="http://placehold.it/50" alt="Page Logo"> Brand Title</a>
CSS:
a.navbar-brand { /*or add another class instead of changing this*/
display:block;
margin:50px 0 10px 0; /* Adjust the margin : top right bottom left */
}
Just keep some margins on top and bottom of that <a> tag. Don't depend on other elements for margin of that <a> tag, instead apply cssrule on itself for it's margin.
Or just put in inside another .row:
<div class='row'>
<a class="navbar-brand" href="#"><img src="images/logoSmall.png" alt="Page Logo"> Brand Title</a>
</div>

Close your the <div class="container"> and open a new container with a margin top around the second row of the nav bar.
Bootply example
Updated HTML:
<div class="navbar navbar-default navbar-fixed-top custom-header" role="navigation">
<div class="container">
<div class="navbar-header transparent">
<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>
<a class="navbar-brand" href="#"><img src="http://placehold.it/50" alt="Page Logo"> Brand Title</a>
</div>
<div class="container new-nav-line">
<div class="row">
<div class="col-lg-12 custom-navbar-line">
<div class="collapse navbar-collapse">
<ul class="nav nav-pills custom-nav-pills">
<li class="active"><a ng-href="#">Home</a></li>
<li><a ng-href="#">Page1</a></li>
<li><a ng-href="#">Page2</a></li>
<li><a ng-href="#">Page3</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
CSS:
.new-nav-line{
margin-top:20px;
}

Related

Link behind image doesn't work

We are working on a website.
However, we have for some unknown reason trouble with the links.
When you are not on the homepage of the site, you can click on logo in the corner and then you should go back to the homepage, the index.php.
This is the code. Do we do something wrong?
</a>
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-default navbar-fixed-top" role="navigation" id="top-nav">
<div class="container">
<div class="navbar-header">
<!-- Logo Starts -->
<a class="navbar-brand" href="index.php"><img src="image.png" alt="logo"></a>
<!-- #Logo Ends -->
<button type="button" class="navbar-toggle collapsed" 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 class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right scroll">
<li>Mop Toevoegen</li>
<?php
if($ip == '****') {
echo "<li ><a href='#'>Login</a></li>";
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
Is anchor tag css display: block; ? Check it.
Try
href='./index.php'
Maybe it is not picking up the address of the file correctly.

Banner responsive on xs devices

I got banner 750x100 above the navbar. When I minimize window to col-xs, I got two problems -
1) Navbar-brand skip under the line. (Red line)
2) Banner is too small, I want align it to center or enlarge the height. (Blue line)
<div class="container-fluid banner text-center">
<div class="row">
<div class="col-md-12">
<a href="#">
<img class="img-responsive" src="http://placehold.it/750x100" alt="" style="margin: 0 auto;">
</a>
</div>
</div>
</div>
<nav class="navbar navbar-inverse">
<div class="container">
<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="#">Some long texthere</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li>about</li>
<li>about</li>
<li>about</li>
<li>about</li>
</ul>
</div>
</div>
</nav>
It's possible to arrange place as I wrote, or should I try other way?

Vertical Spacing between Div needs to be removed

I am new to Web Dev, and i am facing an issue wrt to Div : https://jsfiddle.net/debashis_gt540m/17mmmxps/2/
The three div's at the end have some amount of spacing in between them, I've tried with inserting all 3 div's within a single one, but it didn't help. Anyone ? I want to get rid of the spaces between the 3 div's.
The code is:
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<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="https://in.linkedin.com/in/debdebashis" target="_blank">Debashis Deb</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>Home
</li>
<li>About Me
</li>
<li>Skills
</li>
<li>Interests
</li>
<li>Contact Me
</li>
<li>
<a> </a>
</li>
</ul></div>
</div>
</nav>
<div>
<div class="container-fluid bg-1 well">
<div class="row">
</div>
</div>
<div class="container-fluid bg-2 well">
</div>
<div class="container-fluid bg-3 well">
</div>
</div>
.well {
margin-bottom: 0px !important;
}
the 3 divs have bottom margins, that's what adding the space. add this css:
.container-fluid{margin-bottom:0px;}

on window resize responsive header

I have a bootstrap container like below.
in one col-xs-6, I have my logo and in other col-xs-6, I have cart icon and my toggle menu.
When I resize my browser window, I want to have my logo to have fixed position, but I want to move my cart icon and my navigation together.
<div class="header-wrapper">
<div class="container">
<div class="row">
<div class="col-xs-6">
<img src="assets/logo.png" alt="">
</div>
<div class="col-xs-6">
<span>1</span><i class="fa fa-shopping-cart"></i>
Menu <i class="fa fa-bars"></i>
</div>
</div>
</div>
</div>
Here's the fiddle for the same. for some reason, It is not coming in the same line of logo as well.
Please help.
You need to overwrite your .menu-toggle class to {display:inline-block;}
Instead of your code structure you can write,
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<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>
<a class="navbar-brand" href="#" class="logo"><img src="assets/logo.png" alt=""></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav pull-right">
<li class="">1</li>
<li>Menu</li>
</ul>
</div>
</div>
</div>
in this case menu will collapse in small screen.

Boostrap 3 brand logo goes hidden in nav bar

This simple thing is frustrating me for hours. I have a simple navigation bar which has a brand logo. But the logo disappears sometimes(still loaded but hidden below) from the navigation bar.
HTML:
<nav class="header_blue navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle pull-left" 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>
<div class="navbar-inner">
<a class="navbar-brand" href="">
<img id="my_img" style="display:block !important;" src="img/logo_img.png" alt="logo_img" class="img-responsive">
</a>
</div>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
</ul>
<div class="nav navbar-nav navbar-right" ng-hide="currentUserSignedIn">
<ul class="list-inline pull-right">
<li>
Register
</li>
<li>
<a href="" id="sign_in" data-target="login_modal" >Sign In</a>
</li>
</ul>
</div>
</div>
</div></nav>
CSS:
.header_blue{
background:none repeat scroll 0% 0% #073648;}