How to fix my navbar - html

I have looked at other questions, but I just can't seem to fix the dropdown menu in my navbar.
I'm trying to make a dropdown menu like the one that is here, it's in the top right corner.
This is my code:
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" 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>
<!-- You'll want to use a responsive image option so this logo looks good on devices - I recommend using something like retina.js (do a quick Google search for it and you'll find it) -->
<a class="navbar-brand" href="#">Loveland Tigers</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav navbar-right">
<li>About</li>
<li class="dropdown">
Teams<b class="caret"></b>
<ul class="dropdown-menu">
<li>Freshman</li>
<li>Junior Varsity</li>
<li>Varsity</li>
</ul>
</li>
<li>Contact</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav>
The dropdown menu does not show up when I click on the little arrow.

Remove those unneccessary classes from navbar-collapse div:
<div class="navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li>About</li>
<li class="dropdown"> Teams<b class="caret"></b>
<ul class="dropdown-menu">
<li>Freshman</li>
<li>Junior Varsity</li>
<li>Varsity</li>
</ul>
</li>
<li>Contact</li>
</ul>
</div>
<!-- /.navbar-collapse -->
Working Fiddle.

Related

How do I make a Bootstrap navbar responsive in Angular?

I'm currently creating a responsive Bootstrap navbar in Angular. I'm using Bootstrap v3.
However, the toggle navigation doesn't open in a mobile view and the "Manage" dropdown isn't working.
app.component.html
<div class="container">
<div class="row">
<div class="col-sm-12">
<app-header></app-header>
</div>
</div>
</div>
header.component.html
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- 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="#">Recipe Book</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">
<li class="active">Recipes <span class="sr-only">(current)</span></li>
<li>Shopping Lists</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
Manage <span class="caret"></span>
<ul class="dropdown-menu">
<li>Save Data</li>
<li>Fetch Data</li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>

Make items to disappear when clicking elsewhere

I've the following HTML NavBar:
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top navbar-custom" style="margin-bottom : 0px;">
<div class="container-fluid" ng-controller = "NavController">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span> Menu <span ng-show="userCart.cart_size>0" style="color:orange">({{userCart.cart_size}}) </span><i class="fa fa-bars"></i>
</button>
<a class="navbar-brand" href="#page-top">XYZ IoT</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">
<li class="hidden">
</li>
<li class="page-scroll">
Products
</li>
<li class="page-scroll">
About
</li>
<li class="page-scroll">
Contact
</li>
<!-- Add the Login Anchor -->
<li ng-if="!userInfo.authorization">
Login
</li>
<li ng-if="userInfo.authorization">
My Devices
</li>
<li ng-if="userInfo.authorization">
Logout
</li>
</ul>
</div>
</div> <!-- /.navbar-collapse -->
</nav>
The problem is : When the compressed Nav appears, and I click on it, the menu items appear -- so far fine. But as soon I click else where, the menu stays as is. I have to click on the Menu (3 lines) to make menu items to disappear.
Can it be accomplished? I'm using bootstrap

Boostrap navbar doesn't adjust width well

I dont't know why incrementing the width on my navbar the incrementation only occur on the right side of the bar, for example, this is my html of my bar:
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
<li>
Free shipping over $50
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a class ="lita" href="#about">Be part of THE CIRLCE</a>
</li>
<li>
JOIN
</li>
<li>
LOGIN
</li>
</ul>
</div>
Using this css:
#bs-example-navbar-collapse-1{
background-color: #fde6dc;
padding: 2px 40px;
width: 100%;
}
The result is this one:
http://postimg.org/image/m7qu1vz45/full/
But, if I move the width by 150%, this happen:
http://postimg.org/image/60px3u3m9/full/
Why is this happening? Why it doesn't adjust keeping the ratio, if I put a margin It kind of resolve the problem, but when I re-size the screen it doesn't work.
Anyone has an idea?
Please try this for navbar,
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- 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 navbar-left">
<li>
Free shipping over $50
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Link</li>
<li>
<a class ="lita" href="#about">Be part of THE CIRLCE</a>
</li>
<li>
JOIN
</li>
<li>
LOGIN
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>

Bootstrap Navbar in container but container below is a different size

I have created a navbar and made it container width by adding .container to the .navbar classes. I have created a new row below but its container is less wide than the navbar. I'm sure I've done something stupid but not sure what
<div class="navbar navbar-default navbar-fixed-top container" role="navigation" id="topnavbar">
<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>
<a class="navbar-brand" href="#"><img src="assets/newOrangelogo2.svg" width="300"></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 pull-right">
<li class="active">Home</li>
<li class="dropdown">
About <span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li><a class="sliding-u-l-r" href="#">About Me</a></li>
<li>Services</li>
<li>Process</li>
<li>Clients</li>
<li>Prices</li>
</ul>
</li>
<li>Work</li>
<li>Contact</li>
<li>Blog</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</div>
<div class="container">
<div class="row no-gutter">
<div class="col-md-12 mainImage">
Image
</div>
</div>
</div>

Move login link to right side of the navbar

I'm trying to move my Login button to the right side of the Navbar.
Here's what I have right now. I managed to move the login button to the right side however, It is not aligned correctly along with the left side of the navbar menu tabs. Thank you so much for your help.
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-01">
<span class="sr-only">Toggle navigation</span>
</button>
<a class="navbar-brand" href="#"><span class="fui-flat"></span></a>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse-01">
<ul class="nav navbar-nav">
<li class="active">Products</li>
<li>Features</li>
<li>Pricing</li>
<li>About</li>
</ul>
<div class="collapse navbar-collapse" id="navbar-collapse-01">
<ul class="nav navbar-right">
<li>Login</li>
</ul>
</div>
</div><!-- /.navbar-collapse -->
</nav><!-- /navbar -->
Just add class navbar-nav. Working Bootply
<ul class="nav navbar-nav navbar-right">
<li>Login</li>
</ul>
Try with class pull-right.
<ul class="pull-right nav navbar-nav">
<li>Login</li>
</ul>