How to put logo on left and menu on right? - html

I'd like to make a header like this site or this site, I mean I want to put logo on left side and menu on right. But my header doesn't float well on here. I am confused now.
#header-right {
float: left;
}
#header-right {
float: right;
}
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<div class="wrapper">
<!-- Header -->
<header id="header" class="header">
<div class="container" id="header-inner">
<div class="row">
<div id="header-left" class="clearfix">
<div id="logo" class="logo">
<a href="#">
<img src="http://i.huffpost.com/gen/4252154/images/o-EMBLEM-facebook.jpg" alt="logo" id="logo-img" class="logo-img" height="35" width="150">
</a>
</div> <!-- logo -->
</div> <!-- header-left -->
<div id="header-right">
<nav class="navbar navbar-default" id="">
<div class="navbar-header">
<a class="navbar-brand" href="#">Apple Juice</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div> <!-- navbar-header -->
<!-- Global Navigation -->
<div class="gnav collapse navbar-collapse" id="navbar-main">
<ul class="nav navbar-nav">
<li class="dropdown active">
<a class="" data-toggle="dropdown" href="index.html">Home <i></i></a>
<!-- Dropdown -->
<ul class="dropdown-menu">
<li>
<a class="" href='#'>ジュース <i class=""></i></a>
<ul class="sub-dropdown">
<li>オレンジ</li>
<li>アップル</li>
<li>グレープ</li>
</ul>
</li>
<li>
<a class="" href='#'>寿司 <i class=""></i></a>
<ul class="sub-dropdown">
<li>マグロ</li>
<li>サーモン</li>
<li>エンガワ</li>
</ul>
</li>
</ul> <!-- dropdown-menu -->
</li> <!-- dropdown active-->
<li class="dropdown">
<a class="" data-toggle="dropdown" href="index.html">items <i class="fa fa-angle-down" aria-hidden="true"></i></a>
<ul class="dropdown-menu">
<li>
<a class="" href='#'>スマートフォン <i class=""></i></a>
<ul class="sub-dropdown">
<li>iPhone</li>
<li>Xperia</li>
<li>Galaxy</li>
</ul>
</li>
<li>
<a class="" href='#'>野菜 <i class=""></i></a>
<ul class="sub-dropdown">
<li>トマト</li>
<li>レタス</li>
<li>枝豆</li>
</ul>
</li>
</ul> <!-- dropdown-menu -->
</li> <!-- dropdown -->
<li class="dropdown">
<a class="" data-toggle="dropdown" href="index.html">order <i></i></a>
<ul class="dropdown-menu">
<li><a class="" href='#'>自分用</a></li>
<li><a class="" href='#'>他人用</a></li>
</ul> <!-- dropdown-menu -->
</li> <!-- dropdown -->
<li class="dropdown">
<a class="" data-toggle="dropdown" href="index.html">contact <i></i></a>
<ul class="dropdown-menu">
<li><a class="" href='#'>フォーム</a></li>
<li><a class="" href='#'>電話</a></li>
</ul> <!-- dropdown-menu -->
</li> <!-- dropdown -->
</ul> <!-- nav navbar-nav -->
</div> <!-- gnav collapse navbar-collapse -->
</nav> <!-- navbar navbar-default -->
</div> <!-- header-right -->
</div> <!-- clearfix -->
</div> <!-- row -->
</div> <!-- container -->
</header>
</div> <!-- wrapper -->
Ah, I usually use clearfix in <div class="row"> or in <header> not in <div id="header-left">, but I wrote that in <div id="header-left">.

your css is wrong please replace one of properties as
#header-left {
float: left;
display: inline-block;
}
This will make sure your left block takes only area that it fits into.

You can use the .navbar-right class:
Align nav links, forms, buttons, or text, using the .navbar-left or .navbar-right utility classes. Both classes will add a CSS float in the specified direction. For example, to align nav links, put them in a separate <ul> with the respective utility class applied.
Please check the result. Is it what you want to achieve?
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header"><button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#bs-navbar" aria-expanded="false">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
Brand
</div>
<div id="bs-navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li>Right 1</li>
<li>Right 2</li>
<li>Right 3</li>
</ul>
</div>
</div>
</nav>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
Update
I've used <ul class="nav navbar-nav navbar-right"> instead of <ul class="nav navbar-nav"> in your code:
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<div class="wrapper">
<!-- Header -->
<header id="header" class="header">
<div class="container" id="header-inner">
<div class="row">
<div id="header-left" class="clearfix">
<div id="logo" class="logo">
<a href="#">
<img src="http://i.huffpost.com/gen/4252154/images/o-EMBLEM-facebook.jpg" alt="logo" id="logo-img" class="logo-img" height="35" width="150">
</a>
</div> <!-- logo -->
</div> <!-- header-left -->
<div id="header-right">
<nav class="navbar navbar-default" id="">
<div class="navbar-header">
<a class="navbar-brand" href="#">Apple Juice</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div> <!-- navbar-header -->
<!-- Global Navigation -->
<div class="gnav collapse navbar-collapse" id="navbar-main">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown active">
<a class="" data-toggle="dropdown" href="index.html">Home <i></i></a>
<!-- Dropdown -->
<ul class="dropdown-menu">
<li>
<a class="" href='#'>ジュース <i class=""></i></a>
<ul class="sub-dropdown">
<li>オレンジ</li>
<li>アップル</li>
<li>グレープ</li>
</ul>
</li>
<li>
<a class="" href='#'>寿司 <i class=""></i></a>
<ul class="sub-dropdown">
<li>マグロ</li>
<li>サーモン</li>
<li>エンガワ</li>
</ul>
</li>
</ul> <!-- dropdown-menu -->
</li> <!-- dropdown active-->
<li class="dropdown">
<a class="" data-toggle="dropdown" href="index.html">items <i class="fa fa-angle-down" aria-hidden="true"></i></a>
<ul class="dropdown-menu">
<li>
<a class="" href='#'>スマートフォン <i class=""></i></a>
<ul class="sub-dropdown">
<li>iPhone</li>
<li>Xperia</li>
<li>Galaxy</li>
</ul>
</li>
<li>
<a class="" href='#'>野菜 <i class=""></i></a>
<ul class="sub-dropdown">
<li>トマト</li>
<li>レタス</li>
<li>枝豆</li>
</ul>
</li>
</ul> <!-- dropdown-menu -->
</li> <!-- dropdown -->
<li class="dropdown">
<a class="" data-toggle="dropdown" href="index.html">order <i></i></a>
<ul class="dropdown-menu">
<li><a class="" href='#'>自分用</a></li>
<li><a class="" href='#'>他人用</a></li>
</ul> <!-- dropdown-menu -->
</li> <!-- dropdown -->
<li class="dropdown">
<a class="" data-toggle="dropdown" href="index.html">contact <i></i></a>
<ul class="dropdown-menu">
<li><a class="" href='#'>フォーム</a></li>
<li><a class="" href='#'>電話</a></li>
</ul> <!-- dropdown-menu -->
</li> <!-- dropdown -->
</ul> <!-- nav navbar-nav -->
</div> <!-- gnav collapse navbar-collapse -->
</nav> <!-- navbar navbar-default -->
</div> <!-- header-right -->
</div> <!-- clearfix -->
</div> <!-- row -->
</div> <!-- container -->
</header>
</div> <!-- wrapper -->

Related

Embed Bootstrap 3 navbar in header

In bootstrap I want to create a page header which consists of a static header, a navbar in a second row and a profile picture to the right, like this:
The profile picture should be of fixed size, the title and nav bars should have the same size each and should fill the screen width.
Problem is, I got no clue how to achieve this in css, especially sind it needs to embed a bootstrap navbar. My only idea would be an old-fashioned 2x2 table where the picture spans two rows, but tables are not meant for layout problems, so sure there must be some better way in css?
To show full effect Watch full-screen view.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="">
<div class="row">
<div class="col-md-11">
<nav class="navbar navbar-default navbar-fixed-top" style="border-radius: 5px 5px 0px 0px; border-bottom: none; border-right: 1px solid #e7e7e7; width: 91.5%">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
</div>
<!-- /.container-fluid -->
</nav>
<nav class="navbar navbar-default" style="margin-top: 50px; border-radius: 0px 0px 5px 5px; border-top: none">
<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>
</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 >
<a href="#">Link
<span class="sr-only">(current)</span>
</a>
</li>
<li>
Link
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
Action
</li>
<li>
Another action
</li>
<li>
Something else here
</li>
<li role="separator" class="divider"></li>
<li>
Separated link
</li>
<li role="separator" class="divider"></li>
<li>
One more separated link
</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li>
Link
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
Action
</li>
<li>
Another action
</li>
<li>
Something else here
</li>
<li role="separator" class="divider"></li>
<li>
Separated link
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
</div> <div class="col-md-1">
<div style="background-color: #f0f0f0; margin-left: -30px; padding-left: 10px; position: fixed">
<img src="https://cdn4.iconfinder.com/data/icons/dragon/512/User.png" alt="" class="" style="width:100px; margin-left: 10px ">
</div>
</div>
</div>
<!--/.row-->
<div style="height: 100vh;"></div>
</div>
<!--/.container-fluid-->
Use bootstrat 3's media styling
In this snippet I used only 1 embedded BS Nav and added a border color to delineate the media objects
ALSO - Bootstrap navs are responsive so when you run the snippet switch to expanded view
.media {
border: 1px solid gray;
}
.media, .media-body {
overflow: visible !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="row">
<div class="col-sm-offset-2 col-sm-8">
<div class="media">
<div class="media-body">
<h4 class="media-heading">Media heading</h4>
<div>
<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="#">Brand</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">Link <span class="sr-only">(current)</span></li>
<li>Link</li>
<li class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
<li role="separator" class="divider"></li>
<li>One more separated link</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
</div>
</div>
<div class="media-right">
<a href="#">
<img class="media-object" src="http://via.placeholder.com/80x80" alt="Portrait">
</a>
</div>
</div>
<div class="media">
<div class="media-body">
<h4 class="media-heading">Media heading</h4>
<nav>Nav</nav>
</div>
<div class="media-right">
<a href="#">
<img class="media-object" src="http://via.placeholder.com/80x80" alt="Portrait">
</a>
</div>
</div>
<div class="media">
<div class="media-body">
<h4 class="media-heading">Media heading</h4>
<nav>Nav</nav>
</div>
<div class="media-right">
<a href="#">
<img class="media-object" src="http://via.placeholder.com/80x80" alt="Portrait">
</a>
</div>
</div>
</div>
</div>

How to add two <li> in right of navbar

I have navbar with some <li> at it.
Here is my HTML and CSS code:
<nav class="navbar navbar-default navbar-fixed-top navbar-centered" role="navigation">
<div class="container" style="position: relative">
<div class="navbar-header page-scroll">
<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>
<a class="navbar-brand page-scroll" href="#page-top">
<img src="~/Images/logo.png" /></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">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden">
<a class="page-scroll" href="#page-top"></a>
</li>
<li style="margin-left: 35px; margin-top: 10px;">
<a class="page-scroll" href="#about">About Us</a>
</li>
<li style="margin-left: 35px; margin-top: 10px;">
<a class="page-scroll" href="#services">Benefits</a>
</li>
<li style="margin-left: 35px; margin-top: 10px;">
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
I need to add there two <li>, but it need to be at right of navbar.
Something like this:
How I can do this?
<nav class="navbar navbar-default navbar-fixed-top navbar-centered" role="navigation">
<div class="container" style="position: relative">
<div class="navbar-header page-scroll">
<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>
<a class="navbar-brand page-scroll" href="#page-top">
<img src="~/Images/logo.png" /></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" style="float:left">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden">
<a class="page-scroll" href="#page-top"></a>
</li>
<li style="margin-left: 35px; margin-top: 10px;">
<a class="page-scroll" href="#about">About Us</a>
</li>
<li style="margin-left: 35px; margin-top: 10px;">
<a class="page-scroll" href="#services">Benefits</a>
</li>
<li style="margin-left: 35px; margin-top: 10px;">
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
<ul style="float:right">
<li><a>Try it Risk free</a></li>
<li><a>login</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
You can add another <ul> element with navbar-right class to it
<nav class="navbar navbar-default navbar-fixed-top navbar-centered" role="navigation">
<div class="container" style="position: relative">
<div class="navbar-header page-scroll">
<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>
<a class="navbar-brand page-scroll" href="#page-top">
<img src="~/Images/logo.png" /></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">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden">
<a class="page-scroll" href="#page-top"></a>
</li>
<li style="margin-left: 35px; margin-top: 10px;">
<a class="page-scroll" href="#about">About Us</a>
</li>
<li style="margin-left: 35px; margin-top: 10px;">
<a class="page-scroll" href="#services">Benefits</a>
</li>
<li style="margin-left: 35px; margin-top: 10px;">
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
//this is the nav elments towards right
<ul class="nav navbar-nav navbar-right">
<li>Right Link1</li>
<li>Right Link 2</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
You can use display flex on the Nav
CSS
ul.nav{
display:flex;
align-items: flex-start;
}
ul.nav li.right{
align-self: flex-end;
color: red;
border: 2px solid red;
}
HTML
ul.nav
li*3 // normal links
li.right*2 // sign up links

Align Navbar bottom-left

i'm working on this website and as you can see i've a vertical left navigation. How can i move the navigations link left-bottom (only on desktop) like this?
<header class="span3">
<div class="affix">
<div class="navbar span3">
<div class="navbar-inner">
<a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
<i class="icon-reorder"></i>
</a>
<a class="brand span2" href="index.html">
<img alt="" src="img/logo.png">
</a>
<nav class="nav-collapse collapse">
<ul class="nav">
<li class="nav-home active">Home</li>
<li class="nav-about">Philosophie</li>
<li class="nav-services">Menu</li>
<li class="nav-team">Team</li>
<li class="nav-reservation">Reservation und Öffnungszeiten</li>
<li class="nav-private">Private Dining</li>
<li class="nav-kontakt">Kontakt und Anreise</li>
</ul>
</nav>
</div><!-- /navbar-inner -->
</div><!-- /navbar -->
<!-- <aside class="span3 text-center hidden-phone">
<ul class="social inline">
<li><a class="btn btn-small" href="#"><i class="icon-facebook"></i></a></li>
<li><a class="btn btn-small" href="#"><i class="icon-twitter"></i></a></li>
<li><a class="btn btn-small" href="#"><i class="icon-linkedin"></i></a></li>
</ul>
</aside> -->
</div><!-- /affix -->
</header>
#media(min-width:1024px)
{
/* your style for desktop */
}

how to make navigation down to google nexus menu

i have a menu that look like google nexus 7 on the top of my page! i have another navigation menu in the middle of page. when i click on google menu it appear under the navigation menu. how can i show it upon of navigation menu?
here is my code:
<body>
<div id="page">
<div id="header">
<div class="container">
<ul id="gn-menu" class="gn-menu-main">
<li class="gn-trigger">
<a class="gn-icon gn-icon-menu"><span>Menu</span></a>
<nav class="gn-menu-wrapper">
<div class="gn-scroller">
<ul class="gn-menu">
<li class="gn-search-item">
<input placeholder="جستجو" type="search" class="gn-search">
<a class="gn-icon gn-icon-search"><span>Search</span></a>
</li>
<li>
<a class="gn-icon gn-icon-download">دانلود</a>
</li>
<li><a class="gn-icon gn-icon-article">اخبار</a></li>
<li><a class="gn-icon gn-icon-pictures">عکس ها</a></li>
<li><a class="gn-icon gn-icon-cog">مدیریت</a></li>
<li><a class="gn-icon gn-icon-help">راهنمای سایت</a></li>
</ul>
</div><!-- /gn-scroller -->
</nav>
</li>
<li><a class="login-page" href="http://tympanus.net/codrops">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>حساب کاربری</a></li>
<li><a class="login-page" href="http://tympanus.net/Development/HeaderEffects/">
<span class="glyphicon glyphicon-earphone" aria-hidden="true"></span><span>تماس با ما</span></a></li>
</ul>
</div><!-- /container -->
</div> <!-- /header -->
<div id="wrapper">
<div class="container" id="main-container">
<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">
<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="#">Brand</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">Link <span class="sr-only">(current)</span></li>
<li>Link</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</div> <!-- /container -->
</div> <!-- /wrapper -->
</div> <!-- /page -->
here is first picture of my problem
and here is the second
it's hard to tell 100% without your CSS but it appears to be a z-index issue. Try bumping up your z-index to a high number:
z-index: 1000000; //some high number

Navbar dropdown not working on my local server

I've new to bootstrap and tried to do some mock layout on my local server. Things were going well until I couldn't get the navbar to work on my mock page. I've checked on bothe safari and chrome and the results are still the same.
<!DOCTYPE html>
<html lang="en">
<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>Bootstrap 101 Template</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div 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-collapse">
<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="#">Bootstrap Practice</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class= "active"> Home</li>
<li > About </li>
<li > Blog</li>
<li > Contact Us</li>
<li class= "dropdown">
Themes <b class="caret"></b>
<ul class="dropdown-menu">
<li class= "dropdown-header">Dashboard</li>
<li> Admin 1</li>
<li> Admin 2</li>
<li class="divider"></li>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
Popped your code into Bootply and the only thing I could see that wasn't working was your dropdown wasn't dropping down when clicked.
Your problem is on this line:
Themes <b class="caret"></b>
See the extra space you have in the data-toggle attribute? Remove that, and your dropdown works just fine.
You also had an extra </li> tag in your dropdown. Doesn't break things, but it's not needed.
BOOTPLY
HTML:
<div 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-collapse">
<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="#">Bootstrap Practice</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"> Home</li>
<li> About </li>
<li> Blog</li>
<li> Contact Us</li>
<li class="dropdown">
Themes <b class="caret"></b>
<ul class="dropdown-menu">
<li class="dropdown-header">Dashboard</li>
<li> Admin 1</li>
<li> Admin 2</li>
<li class="divider"></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
You have an error into the
Themes <b class="caret"></b>
the solution is:
Themes<span class="caret"></span>
Here the example:
Fixed example
<div 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-collapse">
<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="#">Bootstrap Practice</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class= "active"> Home</li>
<li> About </li>
<li> Blog</li>
<li> Contact Us</li>
<li class= "dropdown">
Themes<span class="caret"></span>
<ul class="dropdown-menu">
<li class= "dropdown-header">Dashboard</li>
<li> Admin 1</li>
<li> Admin 2</li>
<li class="divider"></li>
<li> Admin 3</li>
</ul>
</li>
</ul>
</div>
</div>
</div><!-- navbar -->