In my bootstrap web app, on the navigation bar header, there is no space on the right hand side. And the logout link is very close to the right border.
How can I give some space on the right ?
Image:
index.html
<!-- Start of Navigation Menu -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation" ng-controller="listController">
<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" rel="home" href="#/list">My Project</a>
</div>
<div class="collapse navbar-collapse">
<div class="bgContainer" style="background-image: url('images/bg_header.gif');">
<ul class="nav navbar-nav">
<li><i class="glyphicon glyphicon-registration-mark"></i>List</li>
<li><i class="glyphicon glyphicon-fire"></i> Two</li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-leaf"></i> Calendar <b
class="caret"></b></a>
<ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
<li><i class="glyphicon glyphicon-eye-open"></i> View Submission </li>
<li><i class="glyphicon glyphicon-eye-open"></i> View Submission </li>
<li><i class="glyphicon glyphicon-calendar"></i> Report </li>
<li><i class="glyphicon glyphicon-list-alt"></i> Template - </li>
<li><i class="glyphicon glyphicon-book"></i> Calendar</li>
<li class="dropdown-submenu"><a tabindex="-1"> <i class="glyphicon glyphicon-cog"></i>Generate
</a>
<ul class="dropdown-menu">
<li><i class="glyphicon glyphicon-cog"></i> Report </li>
<li><i class="glyphicon glyphicon-cog"></i> Draft </li>
</ul></li>
<li><i class="glyphicon glyphicon-eye-open"></i> Feedback</li>
</ul></li>
<li><i class="glyphicon glyphicon-blackboard"></i> Dashboard</li>
</ul>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown"><a class="dropdown-toggle" role="button" data-toggle="dropdown"><i class="glyphicon glyphicon-user"></i>
{{fullName}} <span class="caret"></span></a>
<ul id="g-account-menu" class="dropdown-menu" role="menu">
<li>My Profile</li>
</ul></li>
<li><i class="glyphicon glyphicon-lock"></i> Logout </li>
<!-- Spacer -->
<li> </li>
</ul>
</div>
</div>
</div>
</div>
<!-- End of Navigation Menu -->
This might be caused by .navbar-right class due to positioning or overflow issues with navbar container.
Default bootstrap rule:
.navbar-right {
margin-right: -15px;
}
Override it with:
.navbar-right {
margin-right: 0;
}
Thanks guys.
I just added a white space to the last menu item using
<li><i class="glyphicon glyphicon-lock"></i> Logout </li>
Related
I found a code from
http://usebootstrap.com/theme/facebook
But in this code, I want to make 'Home icon' never be collapsed at any browser size.
CODE:
<div class="navbar navbar-blue navbar-static-top">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
b
</div>
<nav class="collapse navbar-collapse" role="navigation">
<ul class="nav navbar-nav">
<li>
###▽▽▽ I want this icon remain on the navbar, not in collapsed dropdown menu
<i class="glyphicon glyphicon-home"></i>
###△△△ I want this icon remain on the navbar, not in collapsed dropdown menu
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<i class="glyphicon glyphicon-user"></i>
<ul class="dropdown-menu">
<li>More</li>
<li>More</li>
<li>More</li>
</ul>
</li>
</ul>
</nav>
</div>
Bootply: https://www.bootply.com/lEfd188zDg
I tried to move <i class="glyphicon glyphicon-home"></i> to after b, but it looks very ugly.
I want that 'Home icon' is still seen in smaller browser size, being looks nicely not ugly. How can i modify well?
EDIT
Pic:
This simplified code is a little different from above code that i posted firstly.
Simplified code:
<div class="wrapper">
<div class="box">
<div class="row row-offcanvas row-offcanvas-left">
<div class="column col-sm-12 col-xs-12" id="main">
<!-- top nav -->
<div class="navbar navbar-blue navbar-static-top">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<nav class="collapse navbar-collapse" role="navigation">
<ul class="nav navbar-nav">
<li>
<i class="glyphicon glyphicon-home"></i>
</li>
<li>
<i class="glyphicon glyphicon-home"></i>
</li>
<li>
<i class="glyphicon glyphicon-home"></i>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<i class="glyphicon glyphicon-user"></i>
<ul class="dropdown-menu">
<li>More</li>
<li>More</li>
</ul>
</li>
</ul>
</nav>
<!-- /top nav -->
</div>
</div>
</div>
</div>
</div>
original result is like:
and in narrow browser,
But purpose result is like:
Would give me the way how to make this?
I just updated your HTML code and added CSS. Just replace it with yours. Please Only tap nav.
<style>
.heading-icons li{
padding: 9px 10px;
margin-top: 8px;
margin-right: 15px;
}
</style>
<div class="navbar navbar-blue navbar-static-top">
<div class="col-xs-6 col-sm-6">
<ul class="list-inline heading-icons">
<li>
<i class="glyphicon glyphicon-home"></i>
</li>
<li>
<i class="glyphicon glyphicon-home"></i>
</li>
<li>
<i class="glyphicon glyphicon-home"></i>
</li>
</ul>
</div>
<div class="navbar-header col-xs-6 col-sm-6">
<button class="navbar-toggle" type="button" data-toggle="collapse"
data-target=".navbar-collapse">
<span class="sr-only">Toggle</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<nav class="collapse navbar-collapse" role="navigation">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i
class="glyphicon glyphicon-user"></i></a>
<ul class="dropdown-menu">
<li>More</li>
<li>More</li>
</ul>
</li>
</ul>
</nav>
<!-- /top nav -->
</div>
In bootstrap3 I am trying to remove horizontal scroll bar in mobile it looks fine in desktop view but in mobile view the horizontal bar is shown I read that horizontal bar comes due to container-fluid so to I used tag but it is not work
here is the code
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<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="#">RG ACADEMY</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Home</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">About us <span class="caret"> </span> </a>
<ul class="dropdown-menu">
<li>About Academy</li>
<li>Faculty Team</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Courses <span class="caret"> </span> </a>
<ul class="dropdown-menu">
<li>JEE MAINS+ADVANCED</li>
<li>JEE MAINS</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Results <span class="caret"> </span> </a>
<ul class="dropdown-menu">
<li>IIT JEE 2015</li>
<li>JEE MAINS 2015</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Exams Info <span class="caret"> </span> </a>
<ul class="dropdown-menu">
<li>JEE MAINS + ADVANCED</li>
<li>BITSAT</li>
<li>KVPY</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Downloads<span class="caret"> </span> </a>
<ul class="dropdown-menu">
<li>IIT JEE Solutions</li>
<li>JEE MAINS</li>
<li>KVPY</li>
</ul>
</li>
<li>Enquiry</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><span class="glyphicon glyhicon-user"></span> Sign Up</li>
<li><span class="glyphicon glyphicon-log-in"></span> Login</li>
</ul>
</div>
</div>
</nav>
You can use:
overflow:hidden;
in css or declarate it deirect in the html:
<style type="text/css">
.container-fluid {
overflow-x:hidden;
overflow-y:hidden;
overflow:hidden;
}
</style>
I hope it helps
Everything looks fine to me. You probably have some custom CSS doing something wrong. I even tried excluding "viewport" meta tag, still doesn't show overflow.
<!DOCTYPE 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></title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</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="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">RG ACADEMY</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Home</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">About us <span class="caret"> </span> </a>
<ul class="dropdown-menu">
<li>About Academy</li>
<li>Faculty Team</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Courses <span class="caret"> </span> </a>
<ul class="dropdown-menu">
<li>JEE MAINS+ADVANCED</li>
<li>JEE MAINS</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Results <span class="caret"> </span> </a>
<ul class="dropdown-menu">
<li>IIT JEE 2015</li>
<li>JEE MAINS 2015</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Exams Info <span class="caret"> </span> </a>
<ul class="dropdown-menu">
<li>JEE MAINS + ADVANCED</li>
<li>BITSAT</li>
<li>KVPY</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Downloads<span class="caret"> </span> </a>
<ul class="dropdown-menu">
<li>IIT JEE Solutions</li>
<li>JEE MAINS</li>
<li>KVPY</li>
</ul>
</li>
<li>Enquiry</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><span class="glyphicon glyhicon-user"></span> Sign Up</li>
<li><span class="glyphicon glyphicon-log-in"></span> Login</li>
</ul>
</div>
</div>
</nav>
</body>
</html>
I want to make Bootstrap's navbar appear at the top on desktop view and at the bottom on mobile view. It is possible? How can I do it?
There is my actual HTML for top navbar:
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<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="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><span class="fa fa-cloud-upload fa-fw"></span> GitUp</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><span class="fa fa-arrow-left fa-fw"></span> Selección de idioma</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<code><span class="fa fa-code"></span></code> por Federico Damián <span class="fa fa-caret-down"></span>
</a>
<ul class="dropdown-menu">
<li><span class="fa fa-home fa-fw"></span> <strike>Mi casa</strike></li>
<li class="dropdown-header">Contacto</li>
<li><span class="fa fa-github fa-fw"></span> GitHub</li>
<li><span class="fa fa-twitter fa-fw"></span> Twitter</li>
<li><span class="fa fa-facebook-official fa-fw"></span> Facebook</li>
<li><span class="fa fa-google-plus-square fa-fw"></span> Google+</li>
<li class="dropdown-header">Mis proyectos</li>
<li><span class="fa fa-cloud-upload fa-fw"></span> GitUp</li>
<li><span class="fa fa-shield fa-fw"></span> A Shell Blocker</li>
<li><span class="fa fa-arrow-circle-down fa-fw"></span> RoseSpine</li>
<li><span class="fa fa-code fa-fw"></span> KawaiiCode</li>
<li class="dropdown-header">Otros</li>
<li><span class="fa fa-file-code-o fa-fw"></span> Bootstrap</li>
<li><span class="fa fa-fort-awesome fa-fw"></span> Font Awesome</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
Take off the navbar-fixed-top class and add your own css
.navbar-inverse {
position: fixed;
top:0;
left: 0;
width: 100%;
}
#media screen and (max-width: 767px){
.navbar-inverse{bottom: 0; top:auto;}
}
Then at max width 767px screens your navbar will be fixed on the bottom.
I have a very simple Bootstrap Navbar that I am trying to do a little customization to. All I want to do is to pull the title all the left and for the 3 choices Home Menu 1 and Menu 2 to be pulled all the way right. I have tried to add pull-left and pull-right to my inline styling, but believe it is being over written.... Can anyone tell me how I can accomplish this? I will post image and markup below:
The image is what I currently have, not what I am trying to accomplish. The markup is my existing HTML.
Markup
<nav class="navbar navbar-inverse" style="margin-bottom: -5px !important;">
<div class="container">
<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="#">My Title</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li runat="server" class="dropdown">
Menu 1<b class="caret"></b>
<ul class="dropdown-menu">
<li><i class="glyphicon glyphicon-pencil"></i> 3</li>
<li class="divider"></li>
<li><i class="glyphicon glyphicon-folder-close"></i> 4</li>
<li class="divider"></li>
<li><i class="glyphicon glyphicon-thumbs-up"></i> 5</li>
</ul>
</li>
<li runat="server" class="dropdown">
<ul class="dropdown-menu">
<li><i class="glyphicon glyphicon-user"></i> 1</li>
<li class="divider"></li>
<li><i class="glyphicon glyphicon-lock"></i> 2</li>
<li class="divider"></li>
<li><i class="glyphicon glyphicon-log-out"></i> 3</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
Use navbar-right for your links and if you want them as far to the left and right on the screen use container-fluid instead of container.
See example Snippet.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse">
<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="#">My Title</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active">Home
</li>
<li runat="server" class="dropdown"> Menu 1<b class="caret"></b>
<ul class="dropdown-menu">
<li><i class="glyphicon glyphicon-pencil"></i> 3
</li>
<li class="divider"></li>
<li><i class="glyphicon glyphicon-folder-close"></i> 4
</li>
<li class="divider"></li>
<li><i class="glyphicon glyphicon-thumbs-up"></i> 5
</li>
</ul>
</li>
<li runat="server" class="dropdown"> Menu 2<b class="caret"></b>
<ul class="dropdown-menu">
<li><i class="glyphicon glyphicon-user"></i> 1
</li>
<li class="divider"></li>
<li><i class="glyphicon glyphicon-lock"></i> 2
</li>
<li class="divider"></li>
<li><i class="glyphicon glyphicon-log-out"></i> 3
</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
I am trying to align social media icon with my navbar menu to
the right but it is not working there is a gap when I am doing
it.
The social icon is in a separate row
The navbar is also in a separate row
I just want to align them to the right.
The padding-right and pull-right is not working.
Please help, Thank you very much in advance.
CSS code
.navbar-collapse {
padding-right: 0px;
margin-right: 0px;
}
HTML codes
<div class="row" style="height: 40px;">
<div class="container">
<div class="social pull-right">
<ul>
<li><i class="fa fa-lg fa-phone"></i>+65 652 225 25</li>
<li><i class="fa fa-lg fa-weixin"></i></li>
<li><i class="fa fa-lg fa-envelope-o"></i></li>
<li><i class="fa fa-lg fa-facebook"></i></li>
</ul>
</div>
</div>
</div>
<!--Navigation Menu and Carousel -->
<div class="row" style="background-color: black">
<div class="container">
<nav class="navbar navbar-inverse" role="navigation">
<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="index.html">
<img src="images/logo.png" alt="img">
</a>
</div>
<div class="navbar-collapse collapse pull-right">
<ul class="nav navbar-nav">
<li>HOME</li>
<li>SERVICES</li>
<li>WORKS</li>
<li class="dropdown">
ABOUT <b class="caret"></b>
<ul class="dropdown-menu">
<li>Facebook</li>
<li>Twitter</li>
<li>Google+</li>
<li>LinkedIn</li>
</ul>
</li>
<li class="active">CONTACT</li>
</ul>
</div>
</nav>
</div>
</div>
try this
.social ul li{
float:right;
list-style:none;
padding-right:15px
}
<div class="social col-lg-6 pull-right">
DEMO
Try something like this, using the navbar-right class from Bootstrap:
<div class="navbar-collapse collapse pull-right">
<ul class="nav navbar-nav">
<li>HOME</li>
<li>SERVICES</li>
<li>WORKS</li>
<li class="dropdown">
ABOUT <b class="caret"></b>
<ul class="dropdown-menu">
<li>Facebook</li>
<li>Twitter</li>
<li>Google+</li>
<li>LinkedIn</li>
</ul>
</li>
<li class="active">CONTACT</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><i class="fa fa-lg fa-phone"></i>+65 652 225 25</li>
<li><i class="fa fa-lg fa-weixin"></i></li>
<li><i class="fa fa-lg fa-envelope-o"></i></li>
<li><i class="fa fa-lg fa-facebook"></i></li>
</ul>
</div>