How to remove the border-bottom from bootstrap navbar - css

I realize this question has answers that have worked for some but try as I may, I cannot remove this annoying border.
I have tried the following CSS:
.nav-container{
border-width:0;
box-shadow:none;
background-color: aliceblue;
}
.navbar {
background-color: #99ccff;
border: 0;
}
Although the background-color does get set, the border remains.
Here is the site.
index.html:
html,
body {
background-color: aliceblue;
}
.nav-container {
border-width: 0;
box-shadow: none;
background-color: aliceblue;
}
.navbar {
background-color: #99ccff;
border: 0;
}
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap-theme.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<header>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid nav-container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#Writers-Tryst">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div style="display: inline-block">
<a class="navbar-brand" href="#">
<img id="logo" src="img/writers-tryst-logo-min.png" alt="logo" />
</a>
<br/>
<br/>
<div id="shares" class="row">
<!-- Twitter -->
<a href="http://twitter.com/share?url=writers.tryst.ron-tornambe.com&text=<TEXT>&via=<VIA>" target="_blank" title="twitter" class="share-btn twitter">
<i class="fa fa-twitter"></i>
</a>
<!-- Facebook -->
<a href="http://www.facebook.com/sharer/sharer.php?u=http://writers.tryst.com" target="_blank" title="facebook" class="share-btn facebook">
<i class="fa fa-facebook"></i>
</a>
<!-- StumbleUpon (url, title)
<a href="http://www.stumbleupon.com/submit?url=http://writers.tryst.com&title=<TITLE>" target="_blank" class="share-btn stumbleupon" title="stumble-upon">
<i class="fa fa-stumbleupon-circle"></i>
</a> -->
<!-- Reddit (url, title)
<a href="http://reddit.com/submit?url=http://writers.tryst.com&title=<TITLE>" target="_blank" class="share-btn reddit" title="reddit">
<i class="fa fa-reddit-square"></i>
</a> -->
<!-- LinkedIn -->
<a href="http://www.linkedin.com/shareArticle?url=http://writers.tryst.com&title=<TITLE>&summary=<SUMMARY>&source=<SOURCE_URL>" target="_blank" title="linked-in" class="share-btn linkedin">
<i class="fa fa-linkedin"></i>
</a>
<!-- Google Plus -->
<a href="https://plus.google.com/share?url=writers.tryst.ron-tornambe.com" target="_blank" title="google+" class="share-btn google-plus">
<i class="fa fa-google-plus"></i>
</a>
</div>
</div>
</div>
<!--navbar-header-->
<div class="collapse navbar-collapse" id="Writers-Tryst">
<ul class="nav navbar-nav">
<li class="active"><a id="homepage" href="#/"><i class="acctive glyphicon glyphicon-home fa fa-home"></i> Home</a>
</li>
<li> Writers
</li>
<li> Enablers
</li>
<li> About
</li>
<li> Privacy/Rules
</li>
<li> Contact
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a id="login" href="#log-in"><i class="fa fa-sign-in"></i> Log-In</a>
</li>
<li><a id="accounts-link" href="#accounts"><i class="fa fa-user hidden"></i> Create Account</a>
</li>
<li class="dropdown" data-toggle="popover" data-trigger="hover" data-placement="bottom">
<button class="btn btn-custom-primary dropdown-toggle fa fa-user" style="margin-top: 8px; color: white;" data-html="true" type="button" id="user-dropdown-link" data-toggle="dropdown"><span class="caret"></span>
</button>
</a>
<ul class="dropdown-menu" role="menu" data-aria-labelledby="create-account-link">
<li><a id="update-profile" href="#update-profile" class="fa fa-database"> Update profile</a>
</li>
<li><a id="manage-uploads" href="#manage-uploads" class="fa fa-book"> Manage uploads</a>
</li>
<li><a id="review-submissions" href="#review-submissions" class="fa fa-book"> Review Submissions</a>
</li>
<li><a id="update-submissions" href="#update-submissions" class="fa fa-book"> Update Reviews</a>
</li>
</ul>
</li>
<li>
<a id="reset-pwd-link" href="#reset-pwd"></a>
</li>
</ul>
</div>
<!--navbar-collapse-->
</div>
<!--container fluid-->
</nav>
</header>
<div>
<div id="message" class="alert m-t-10 m-b-10"></div>
<div id="main" class="content container">
<!-- angular templating -->
<!-- this is where content will be injected -->
<div data-ng-view></div>
</div>
<footer class="panel panel-default panel-transparent">
<div id="footer" class="text-right small">© 2016 Ronald Tornambe, Inc.</div>
</footer>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

There is a box shadow added by the bootstrap theme. The following rules will remove it as well as on the .navbar-collapse class when the nav is under 768px.
Note: you have a stray tag after the fa fa-user button and are (possibly) using normalize.css twice since Bootstrap3 uses a version of it all ready. See normalize.less.
.navbar.navbar-default {
background-color: #99ccff;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.navbar.navbar-default .navbar-collapse {
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
Before with box-shadow:
After removing the box-shadow:
Working Example:
/*FOR DEMO ONLY*/
html,
body {
background: aliceblue;
}
/*FOR DEMO ONLY*/
.nav-container {
border-width: 0;
box-shadow: none;
background-color: aliceblue;
}
.navbar.navbar-default {
background-color: #99ccff;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.navbar.navbar-default .navbar-collapse {
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap-theme.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<header>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid nav-container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#Writers-Tryst">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div style="display: inline-block">
<a class="navbar-brand" href="#">
<img id="logo" src="https://writers-tryst.com//img/writers-tryst-logo-min.png" alt="logo" />
</a>
<br/>
<br/>
<div id="shares" class="row">
<a href="http://twitter.com/share?url=writers.tryst.ron-tornambe.com&text=<TEXT>&via=<VIA>" target="_blank" title="twitter" class="share-btn twitter">
<i class="fa fa-twitter"></i>
</a>
<a href="http://www.facebook.com/sharer/sharer.php?u=http://writers.tryst.com" target="_blank" title="facebook" class="share-btn facebook">
<i class="fa fa-facebook"></i>
</a>
<a href="http://www.linkedin.com/shareArticle?url=http://writers.tryst.com&title=<TITLE>&summary=<SUMMARY>&source=<SOURCE_URL>" target="_blank" title="linked-in" class="share-btn linkedin">
<i class="fa fa-linkedin"></i>
</a>
<a href="https://plus.google.com/share?url=writers.tryst.ron-tornambe.com" target="_blank" title="google+" class="share-btn google-plus">
<i class="fa fa-google-plus"></i>
</a>
</div>
</div>
</div>
<div class="collapse navbar-collapse" id="Writers-Tryst">
<ul class="nav navbar-nav">
<li class="active"><a id="homepage" href="#/"><i class="acctive glyphicon glyphicon-home fa fa-home"></i> Home</a>
</li>
<li> Writers
</li>
<li> Enablers
</li>
<li> About
</li>
<li> Privacy/Rules
</li>
<li> Contact
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a id="login" href="#log-in"><i class="fa fa-sign-in"></i> Log-In</a>
</li>
<li><a id="accounts-link" href="#accounts"><i class="fa fa-user hidden"></i> Create Account</a>
</li>
<li class="dropdown" data-toggle="popover" data-trigger="hover" data-placement="bottom">
<button class="btn btn-custom-primary dropdown-toggle fa fa-user" style="margin-top: 8px; color: white;" data-html="true" type="button" id="user-dropdown-link" data-toggle="dropdown"><span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" data-aria-labelledby="create-account-link">
<li><a id="update-profile" href="#update-profile" class="fa fa-database"> Update profile</a>
</li>
<li><a id="manage-uploads" href="#manage-uploads" class="fa fa-book"> Manage uploads</a>
</li>
<li><a id="review-submissions" href="#review-submissions" class="fa fa-book"> Review Submissions</a>
</li>
<li><a id="update-submissions" href="#update-submissions" class="fa fa-book"> Update Reviews</a>
</li>
</ul>
</li>
<li>
<a id="reset-pwd-link" href="#reset-pwd"></a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div>
<div id="message" class="alert m-t-10 m-b-10"></div>
<div id="main" class="content container">
<div data-ng-view></div>
</div>
<footer class="panel panel-default panel-transparent">
<div id="footer" class="text-right small">© 2016 Ronald Tornambe, Inc.</div>
</footer>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

simply apply box-shadow: none; in navbar

You have several declarations for the CSS box-shadow property on the .navbar-default element. If you remove all of those the border will be gone.

The only solution that is working for me is inline css with !important property:
border: none !important; outline: none !important;
inside navbar-toggler:
<button class="navbar-toggler" style="border: none !important; outline: none !important;"
type="button" data-toggle="collapse" data-target="#collapsingNavbar">

Related

Move navbar brand text with an <img> tag

In my navbar I have both image and text (The navbar brand) inside the <a class="navbar-brand> tag. When I added the image, it wasn't vertically centered within the navbar, so I had to give the <img> tag margin-top to align it, but it also pushed the navbar brand down, how can I move the text back up?
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<style>
.navbar {
font-size: 0.8rem;
font-weight:500;
}
.navbar-brand {
padding: 0 15px;
height: 40px;
line-height: 80px;
}
.navbar-toggle {
/* (80px - button height 34px) / 2 = 23px */
margin-top: 23px;
padding: 9px 10px !important;
}
</style>
<link href='#' rel='stylesheet'>
<nav id="bt_navbar" class="navbar navbar-expand-lg fixed-top" style="background: gray!important;">
<div class="container">
<a class="navbar-brand mx-auto" href="#" style="color:white;">
<img src="logo.png" width="30" height="30" class="d-inline-block align-top" alt="logo" style="margin-top:10px;margin-right:5px">
Brand Name
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation" style="background-color:black!important;">
<span class="navbar-toggler-icon" style="back-ground-color:white!important;"></span>
</button>
<div class="collapse navbar-collapse text-right" id="navbarTogglerDemo02">
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item">
<a class="nav-link" href="#" style="color:white">Link 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" style="color:white">Link 2</a>
</li>
</ul>
</div>
</div>
</nav>
I have removed all of the extra classes from the img tag and moved the text inside a span. I used flexbox to center align text and logo.
.navbar-brand {
padding: 0 15px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
}
<a class="navbar-brand mx-auto" href="#" style="color:white;">
<img src="https://loremflickr.com/30/30" width="30" height="30" alt="logo">
<span>Brand Name</span>
</a>
Working Example
https://jsfiddle.net/yj1qjgvp/
Just removed line height in navbar-brand, its conflicting with your image dimesions.
Hope this helps!
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<style>
.navbar {
font-size: 0.8rem;
font-weight:500;
}
.navbar-brand {
padding: 0 15px;
height: 40px;
}
.navbar-toggle {
/* (80px - button height 34px) / 2 = 23px */
margin-top: 23px;
padding: 9px 10px !important;
}
</style>
<link href='#' rel='stylesheet'>
<nav id="bt_navbar" class="navbar navbar-expand-lg fixed-top" style="background: gray!important;">
<div class="container">
<a class="navbar-brand mx-auto" href="#" style="color:white;">
<img src="logo.png" width="30" height="30" class="d-inline-block align-top" alt="logo" style="margin-top:10px;margin-right:5px">
Brand Name
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation" style="background-color:black!important;">
<span class="navbar-toggler-icon" style="back-ground-color:white!important;"></span>
</button>
<div class="collapse navbar-collapse text-right" id="navbarTogglerDemo02">
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item">
<a class="nav-link" href="#" style="color:white">Link 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" style="color:white">Link 2</a>
</li>
</ul>
</div>
</div>
</nav>

Unable to float elements in Bootstrap navbar

Im having problems to float elements to the right inside bootstrap navbar, I need to apply float:right to Option 1 and Option 2 elements, and center Search Input, I tried !important rule but still doesnt work, and when the content is collapsed and you click navbar toggler button it moves some px from the left.
Edit: I also need to display navbar when is collapsed in this order: Brand - Search Input - Toggler button. And the content of toggler button under Search Input.
Here is the relevant code:
.navbar{
background-image: cornflowerblue;
}
#mainNav{
border: 5px solid black;
margin: 3%;
background-color: white;
}
body{
background-color: grey;
}
#navContent{
background-color: white;
margin: 3%;
}
#final{
border: 5px solid black;
margin: 3%;
background-color: white;
}
#searchForm{
margin: auto;
}
#test{
text-align: center;
border: 5px solid black;
float: right;
}
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="container-fluid">
<section class="row" id="mainNav">
<nav class="navbar navbar-expand-xs rounded">
<a class="navbar-brand" href="#">Brand</a>
<form class="form-inline" id="searchForm" role="search">
<div class="input-group">
<input class="form-control" type="text" placeholder="Search">
<div class="input-group-btn">
<button class="btn btn-secondary" type="button"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navToggler" aria-controls="navToggler" aria-expanded="false" aria-label="Toggle navigation">
<i class="fa fa-bars"></i>
</button>
<div id="test">
<div class="collapse navbar-collapse" id="navToggler">
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="#">Option 1</a></li>
<li class="nav-item"><a class="nav-link" href="#">Option 2</a></li>
</ul>
</div>
</div>
</nav>
</section>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<script src="js/index.js"></script>
</body>
just add <div class="col-md-12"></div> below to section it'll be works
.navbar{
background-image: cornflowerblue;
}
#mainNav{
border: 5px solid black;
margin: 3%;
background-color: white;
}
body{
background-color: grey;
}
#navContent{
background-color: white;
margin: 3%;
}
#final{
border: 5px solid black;
margin: 3%;
background-color: white;
}
#searchForm{
margin: auto;
}
#test{
text-align: center;
border: 5px solid black;
float: right;
}
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="container-fluid">
<section class="row" id="mainNav">
<div class="col-md-12">
<nav class="navbar rounded">
<a class="navbar-brand" href="#">Brand</a>
<form class="form-inline" id="searchForm" role="search">
<div class="input-group">
<input class="form-control" type="text" placeholder="Search">
<div class="input-group-btn">
<button class="btn btn-secondary" type="button"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navToggler" aria-controls="navToggler" aria-expanded="false" aria-label="Toggle navigation">
<i class="fa fa-bars"></i>
</button>
<div id="test">
<div class="collapse navbar-collapse" id="navToggler">
<ul class="nav navbar-nav">
<li class="nav-item"><a class="nav-link" href="#">Option 1</a></li>
<li class="nav-item"><a class="nav-link" href="#">Option 2</a></li>
</ul>
</div>
</div>
</nav>
</div>
</section>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<script src="js/index.js"></script>
</body>
If you want a mega-menu in Bootstrap 4 (like eg. yamm for Boostrap 3), I had success with using flexbox:
<!-- adapted from bs-repo basic navbar example code -->
<nav id="navbar" class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="http://example.com"
id="navbarDropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">Dropdown link</a>
<div class="dropdown-menu"
aria-labelledby="navbarDropdownMenuLink">
<ul class="d-md-inline-flex flex-md-row">
<li class="dropdown-item">
<ul class="d-md-inline-flex flex-md-column">
<li class="dropdown-item">Action</li>
<li class="dropdown-item">Another action</li>
<li class="dropdown-item">Something else here</li>
</ul>
</li>
<li class="dropdown-item">
...
</li>
<li class="dropdown-item">
...
</li>
</ul>
</div>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="text"
placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0"
type="submit">Search</button>
</form>
</div>
</nav>
Use the Bootstrap 4 integrated Flex-System. I cleaned the code a bit and added the magic ml-auto (margin-left:auto).
Give it a try.
.navbar{
background-image: cornflowerblue;
}
#mainNav{
border: 5px solid black;
margin: 3%;
background-color: white;
}
body{
background-color: grey;
}
#navContent{
background-color: white;
margin: 3%;
}
#final{
border: 5px solid black;
margin: 3%;
background-color: white;
}
#searchForm{
margin: auto;
}
<html>
<head>
<title></title>
</head>
<body>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<div class="container-fluid">
<nav class="navbar navbar-expand-lg rounded" id="mainNav">
<a class="navbar-brand" href="#">Brand</a>
<form class="form-inline" id="searchForm" name="searchForm" role="search">
<div class="input-group">
<input class="form-control" placeholder="Search" type="text">
<div class="input-group-btn">
<button class="btn btn-secondary" type="button"><i class="fa fa-search"></i></button>
</div>
</div>
</form>
<button aria-controls="navToggler" aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler" data-target="#navToggler" data-toggle="collapse" type="button"><i class="fa fa-bars"></i></button>
<div class="collapse navbar-collapse ml-auto" id="navToggler">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Option 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Option 2</a>
</li>
</ul>
</div>
</nav>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js">
</script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js">
</script>
</body>
</html>

Bootstrap dropdown-menu appearing off-screen when list is scrollable

I have an un-ordered list <ul> that needs to have a fixed height.
Each item in the list is associated with a Bootstrap dropdown menu
to be opened by a button (...) on each <li> item.
The dropdown menu appears correctly for the first few items.
However, as soon as I scroll down the list and click the ... button,
the dropdown menu would be shown off-screen.
<head>
<link data-require="bootstrap#3.3.7" data-semver="3.3.7" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script data-require="jquery#3.1.1" data-semver="3.1.1" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script data-require="bootstrap#3.3.7" data-semver="3.3.7" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="my-list">
<ul>
<li>
<span>Item 1</span>
<button class="btn btn-link dropdown-toggle" type="button" data-toggle="dropdown">
<i class="glyphicon glyphicon-option-horizontal"></i>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a>Edit</a></li>
</ul>
</li>
<li>
<span>Item 2</span>
<button class="btn btn-link dropdown-toggle" title="More Actions" type="button" data-toggle="dropdown">
<i class="glyphicon glyphicon-option-horizontal"></i>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a>Edit</a></li>
</ul>
</li>
<li>
<span>Item 3</span>
<button class="btn btn-link dropdown-toggle" title="More Actions" type="button" data-toggle="dropdown">
<i class="glyphicon glyphicon-option-horizontal"></i>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a>Edit</a></li>
</ul>
</li>
<li>
<span>Item 4</span>
<button class="btn btn-link dropdown-toggle" title="More Actions" type="button" data-toggle="dropdown">
<i class="glyphicon glyphicon-option-horizontal"></i>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a>Edit</a></li>
</ul>
</li>
</ul>
</div>
style.css
.dropdown-menu {
top: auto;
}
.my-list {
height: 160px;
background-color: rgb(179, 229, 252);
padding-left: 1px;
padding-top: 3px;
padding-bottom: 0;
overflow: auto; /* Enable scrollbar for the list */
}
.my-list li {
list-style-type: none;
padding: 8px 4px 8px 8px;
border-width: thin;
border-bottom-style: solid;
border-bottom-color: rgb(208, 208, 208);
}
Question:
How can I make the dropdown menu appear directly below (*) the "..." button?
(*) Or appear directly above in the case of last item on the list.
Is this the effect that you're looking for?
<div class="my-list">
<ul class= "nav">
<li>
<span>Item 1</span>
<button class="btn btn-link dropdown-toggle" type="button" data-toggle="dropdown">
<i class="glyphicon glyphicon-option-horizontal"></i>
</button>
<ul class="dropdown-menu dropdown-menu">
<li><a>Edit</a></li>
</ul>
</li>
Set the overflow to overflow: visible; needs to be "nav", and class="dropdown-menu dropdown-menu"

How to add icon on top of bootstrap navbar menu

I'm gonna add my own icons on top of each section in menubar, for example: Home icon on top of home, or Car icon on top of Cars, and etc, now it's showing in left side
I tried all suggested ways but icons don't show on top of menu. how can I solve it?
Here is my code:
.navbar-wrapper2{min-height:0px; background:white; border-bottom:0px solid #cccccc; box-shadow: 0 0 5px rgba(0, 0, 0, 0.13); padding-bottom:0px;}
#media (min-width: 992px) {
.navbar-wrapper2{min-height:110px; background:white; border-bottom:0px solid #cccccc; box-shadow: 0 0 5px rgba(0, 0, 0, 0.13); padding-bottom:0px;}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" rel="stylesheet"/>
<div class="navbar navbar-fixed-top navbar-default ">
<div class="container">
<div class="navbar">
<!-- Navigation-->
<div class="navbar-header go-right">
<button data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img src="http://www.sothink.com/page/logo-design/images/company-logo10.jpg" alt="" class="moto">
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right go-left">
<li class="dropdown active go-right">
<a class="dropdown-toggle" href=""> Home </a>
</li>
<li class="go-right ">
<a href="m/hotels" class="" target="_self">
<!--<i class='fa fa-building'></i>--> Hotels </a>
</li>
<li class="go-right ">
<a href="/tours" class="" target="_self">
<!--<i class='fa fa-briefcase'></i>--> Tours </a>
</li>
<li class="go-right ">
<a href="/cars" class="" target="_self">
<!--<i class='fa fa-car'></i>--> Cars </a>
</li>
<li class="go-right ">
<a href="/offers" class="" target="_self">
<!--<i class='fa fa-gift'></i>--> Offers </a>
</li>
<li class="go-right ">
<a href="/blog" class="" target="_self">
<!--<i class='fa fa-building'></i>--> Blog </a>
</li>
<li class="go-right ">
<a href="/flightsd" class="" target="_self">
<!--<i class='fa fa-building'></i>--> Flights </a>
</li>
<li class="go-right ">
<a href="/contact-us" class="" target="">
<!--<i class='glyphicon glyphicon-phone-alt'></i>--> Contact </a>
</li>
<form class="dropdown pull-right">
<div class="styled-select">
<select onchange="change_currency(this.value)" class="selectx" style="margin-top:10px;font-weight: 100;height: 2.3em;" name="currency" id="currency">
<option value="1" selected="">US Dollar</option>
<option value="3">GB Pound</option>
<option value="9">SR Saudi</option>
</select>
</div>
<div class="clearfix"></div>
</form>
<li class="dropdown pull-right">
<a style="border-bottom: 0px;" href="javascript: void();" class="dropdown-toggle" data-toggle="dropdown"><img src="/uploads/images/language/en.png" alt="English" height="14" width="21"> English </a>
<ul style="display: none;" class="dropdown-menu">
<li><img src="http://findicons.com/files/icons/282/flags/48/united_states_of_america_usa.png" alt="" height="14" width="21"> English</li>
<li><img src="http://icons.iconarchive.com/icons/gosquared/flag/64/Russia-icon.png" alt="" height="14" width="21"> Russia</li>
</ul>
</li>
<li class="dropdown pull-right">
My Account <b class="lightcaret mt-2"></b>
<ul style="display: none;" class="dropdown-menu">
<li> Login</li>
<li> Sign Up</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
I highly appreciate it and thank you
you used inline element, so they are showed beside of each.
you should use block elements to take element down.
for example add <p> tag to Hotels
<li class="go-right ">
<a href="m/hotels" class="" target="_self">
<i class='fa fa-building'></i><p>Hotels</p> </a>
</li>
and if you want icons go center of buttons:
add text-align:center; to the parent class of font-awesome <i> tags.
please see this link and notice to editfromStack :
http://jsbin.com/kewahadike/edit?output
or you can add <span> to words like hotel and use span{display:block;} on stylesheet
please see this link:
http://jsbin.com/kumuvenanu/edit?html,output

bootsrap nav not responding well when layout changes

<div class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-brand pull-left">
<a href="#" class="pull-left">
<img width="150" height="45" class="navbar-left" src="Intellicell_files/IntelliCell-Logo.png" /></a>
</div>
<button class="navbar-toggle pull-right" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse navHeaderCollapse pull-right">
<ul class="nav navbar-nav navbar-right navbar-text">
<li><a id="homeLink" href="#" data-target="home_container">Home</a></li>
<li><a id="contractslink" href="Contracts.aspx">Contracts</a></li>
<li><a id="accounts" href="AccountHistory.aspx">Account History</a></li>
<li>Contact Us</li>
<li><a id="refer" href="#">Refer a Friend</a></li>
<li><a id="tracker" href="#">Incentive Tracker</a></li>
</ul>
</div>
</div>
<div class="center-block" id="divider">
<div class="nav-divider">
<h4 class="text-center">HOME</h4>
<%--<asp:Button Text="Logout" CssClass="btn btn-group-sm form-control" ID="btnLogOut" runat="server" align="right" OnClick="btnLogOut_Click"/>--%>
</div>
</div>
</div>
the problem comes when I test the Navbar on a tablet and that causes the navbar to go under the logo that i have put there, so i was wondering if there is a way of making sure that the nav logo and the nav options are always on the same line. i am using bootstrap by the way
One option is to reduce the padding between your links.
Also, see the Docs regarding how to structure a default navbar.
.navbar .navbar-brand {
padding-top: 3px;
}
#media (min-width: 768px) {
.navbar .navbar-nav > li > a {
padding-left: 8px;
padding-right: 8px;
}
}
<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-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navHeaderCollapse" aria-expanded="false"> <span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">
<img width="150" height="45" src="http://placehold.it/150x45/f00" />
</a>
</div>
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav navbar-right">
<li><a id="homeLink" href="#" data-target="home_container">Home</a>
</li>
<li><a id="contractslink" href="Contracts.aspx">Contracts</a>
</li>
<li><a id="accounts" href="AccountHistory.aspx">Account History</a>
</li>
<li>Contact Us
</li>
<li><a id="refer" href="#">Refer a Friend</a>
</li>
<li><a id="tracker" href="#">Incentive Tracker</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="navbar navbar-default navbar-static-top">
<div class="container">
<button class="navbar-toggle pull-right" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse navHeaderCollapse">
<div class="navbar-brand">
<a href="#">
<img height="45" class="navbar-left" src="http://i.ytimg.com/vi/PDfWeUP09TA/hqdefault.jpg" /></a>
</div>
<ul class="nav navbar-nav navbar-right navbar-text">
<li><a id="homeLink" href="#" data-target="home_container">Home</a></li>
<li><a id="contractslink" href="Contracts.aspx">Contracts</a></li>
<li><a id="accounts" href="AccountHistory.aspx">Account History</a></li>
<li>Contact Us</li>
<li><a id="refer" href="#">Refer a Friend</a></li>
<li><a id="tracker" href="#">Incentive Tracker</a></li>
</ul>
</div>
</div>
<div class="center-block" id="divider">
<div class="nav-divider">
<h4 class="text-center">HOME</h4>
<%--<asp:Button Text="Logout" CssClass="btn btn-group-sm form-control" ID="btnLogOut" runat="server" align="right" OnClick="btnLogOut_Click"/>--%>
</div>
</div>
</div>
ul li a{
padding-left: 10px !important;
padding-right: 10px !important;
}
Im not frontend, but it should help :)
I wrapped img and ul by div, and thru smaller padding get img to row with menu.
Its just a suggest, problem is, ul li a is too big, and push img up

Resources