Multiline centered navbar item in bootstrap 4 - css

I have a navbar, and it works fine when there are only single-line items:
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#">FAQ</a>
</li>
<li class="nav-item">
<a class="nav-link profile" href="#">
<div class="profile-info">
<span class="name">Артём</span>
</div>
</a>
</li>
</ul>
</div>
But when item is multiline, the other items lose center vertical alignment and align top instead:
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#">FAQ</a>
</li>
<li class="nav-item">
<a class="nav-link profile" href="#">
<div class="profile-info">
<span class="name">Артём</span>
<span class="balance">31337 ₽</span>
</div>
</a>
</li>
</ul>
</div>
My SASS code:
#site-header {
background: #2d3840;
border-bottom: solid 1px #20272d;
height: 83px;
.navbar-brand {
color: white;
}
.nav-item {
&:not(:first-child) {
margin-left: 25px;
}
&:not(:last-child) {
margin-right: 25px;
}
// General link
a.nav-link {
color: white;
font-size: 16px;
text-align: center;
#include transition(0.5s);
&:hover {
#include transition(0.3s);
color: $color-accent;
}
&.active {
padding: 6px 21px 6px 21px;
background: $color-accent;
border-radius: 17.5px;
box-shadow: 0 2px 10px 0 rgba(90, 175, 238, 0.6);
&:hover {
color: white;
box-shadow: none;
}
}
// Profile
&.profile {
.profile-info {
display: inline-block;
.name {
display: block;
font-weight: bold;
}
.balance {
display: block;
font-size: 16px;
font-weight: bold;
color: $color-accent;
}
}
}
}
}
}
Desired:
So, how to center items when there are multi-line items?

Remove the profile-info and use these classes for the a tag.
d-flex - to make it flex
flex-column - to change its flex-direction property to column
text-right - to align its inline children on the right side of it
<li class="nav-item">
<a class="nav-link d-flex flex-column text-right" href="#">
<span class="name">Артём</span>
<span class="balance">31337 ₽</span>
</a>
</li>
To align the other items vertically in the center of the list, use align-self-center for each one of the li elements.
<li class="nav-item align-self-center">
<a class="nav-link" href="#">FAQ</a>
</li>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/js/bootstrap.js"></script>
<nav 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 ml-auto">
<li class="nav-item active align-self-center">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item align-self-center">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item align-self-center">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
<li class="nav-item align-self-center">
<a class="nav-link" href="#">FAQ</a>
</li>
<li class="nav-item ">
<a class="nav-link d-flex flex-column text-right" href="#">
<span class="name">Артём</span>
<span class="balance">31337 ₽</span>
</a>
</li>
</ul>
</div>
</nav>

Related

-webkit-backdrop-filter is not working on Apple devices

I am trying to blur a dropdown menu for my website. It doesn't seem to work on my Apple devices though. I have tried Mac and iPhone. I am using ASP.NET Core to build the website.
How it's suppose to look
How it looks on Apple/Safari
Navbar style:
##media (max-width: 992px) {
#mainNavbarToggler {
position: absolute;
margin-top: 85px;
padding-left: 5px;
padding-right: 5px;
right: 0;
top:0;
background-color: rgba(0, 0, 0, .25);
border-radius: 10px;
width: 100%;
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .25), 0 3px 5px 0px rgba(0, 0, 0, 0.50) !important;
backdrop-filter:blur(10px);
-webkit-backdrop-filter:blur(10px);
}
}
Here's my Navbar code:
<!--Navigation Bar-->
<nav class="navbar navbar-expand-lg navbar-light d-lg-block shadow-custom" id="navbarMain" style="background-color: rgba(0, 0, 0, .25); z-index:2000">
<div class="container-fluid">
<a class="navbar-brand d-lg-none" asp-area="" asp-page="/Index">
<img src="/assets/logo/PortaBluTitleLogo.svg" alt="Porta Blu Title Logo" width="150" class="d-inline-block align-text-top filter-white">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNavbarToggler" aria-controls="mainNavbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="mainNavbarToggler" style="-webkit-backdrop-filter: blur(10px)">
<!--Standard Navbar-->
<!--Brand-->
<a class="navbar-brand d-none d-lg-block" style="margin-left: 50px; margin-top: 0px" asp-area="" asp-page="/Index">
<img src="/assets/logo/PortaBluTitleLogo.svg" alt="Porta Blu Title Logo" width="200" class="d-inline-block align-text-top filter-white"></a>
<!--Links-->
<ul class="navbar-nav ms-auto" style="font-size: 25px">
<li class="nav-item">
<a class="nav-link" asp-area="" asp-page="/Venue">Venue</a>
</li>
<li class="nav-item">
<a class="nav-link" asp-area="" asp-page="/Office">Offices</a>
</li>
<li class="nav-item">
<a class="nav-link" asp-area="" asp-page="/Services">Services</a>
</li>
<li class="nav-item">
<a class="nav-link" asp-area="" asp-page="/Gallery">Gallery</a>
</li>
<li class="nav-item">
<a class="nav-link" asp-area="" asp-page="/Contact">Contact Us</a>
</li>
</ul>
<!--Standard Navbar End-->
<!--Icons-->
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link nav-icon instagram-gradient-text" href="https://www.instagram.com/portabluoffical/?hl=en" target="_blank" rel="nofollow">
<i class="bi bi-instagram" id="insta" style="color: black; font-size: 2rem"></i>
</a>
</li>
<li class="nav-item">
<a class="nav-link nav-icon" href="https://www.facebook.com/profile.php?id=100068916759970" target="_blank" rel="nofollow"><i class="bi bi-facebook" style="font-size: 2rem; color: cornflowerblue" ></i></a>
</li>
<li class="nav-item">
<a class="nav-link nav-icon" href="https://www.tiktok.com/##portabluvenue" target="_blank" rel="nofollow"><i class="bi bi-tiktok" id="tiktok" style="font-size: 2rem" ></i></a>
</li>
</ul>
<!--Icons End-->
</div>
</div>
</nav>
<!--Navigation Bar End-->
I have looked at almost all the resources on Stack, even inspected elements on safari and copied the code but still no dice. Is there a stylesheet i need to reference?
Also get this, in Visual Studio for Mac, it works with dotnet watch, but when I publish, it stops working. Is it something to do with the server and browser, meaning I have to specify conditions per browser?

How to fixed a header with equal margins in both side?

I think it's a silly question but I'm struggling to adjust the header. Whenever I use the position as fixed or sticky, the margin doesn't work properly.
I want the same margin as the body section. But it's not working properly.
The current situation:
What I'm looking for:
codes I have used:
CSS:
.hh{
background-color:#BADA55;
height:150px;
border-radius:0px 0px 5px 5px;
box-shadow: 0 1px 1px rgba(0,0,0,0.08),
0 2px 2px rgba(0,0,0,0.12),
0 4px 4px rgba(0,0,0,0.16),
0 8px 8px rgba(0,0,0,0.20);
z-index:999;
position: sticky;
/*margin-right: 250px;*/
/*margin-left: 250px;*/
/*margin: 0 auto; */
width: auto;
top: 0;
overflow-x:hidden;
}
.logo{
width:58px;
height:58px;
}
.logoh{
font-size:32px;
float:right;
margin-left:12px; margin-top:3px;
font-family: Arial, Helvetica, sans-serif;
}
.bd{
border-top:3px solid #5D6E1D;
border-bottom:3px solid #5D6E1D;
line-height:0px;
}
HTML:
<div class="hh" >
<div style="width:100%">
<div class="container ">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6 col-sm-12" style="text-align:center; padding:10px">
<div style="display:inline-block">
<div class="navbar-brand">
<img class="logo" src="images/logo.png" style="float:left">
<p class="logoh" style="font-weight:500"> Linda Hammond Research</p>
</div>
</div>
</div>
<div class="col-md-3"></div>
</div>
</div>
<div style="margin-left:15px; margin-right:15px">
<nav class="navbar navbar-expand-lg navbar-light bd ">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" style="float:right">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent" >
<ul class="navbar-nav nav-fill w-100">
<li class="nav-item active">
<a class="nav-link" href="index.php">Home </a>
</li>
<li class="nav-item active">
<a class="nav-link" href="about-me.php">About</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="research.php">Research </a>
</li>
<li class="nav-item active">
<a class="nav-link" href="reports.php">Reports </a>
</li>
<li class="nav-item active">
<a class="nav-link" href="professional-services.php">Professional Services </a>
</li>
<li class="nav-item active">
<a class="nav-link" href="speaker.php">Speaker </a>
</li>
<li class="nav-item active">
<a class="nav-link" href="prices.php">Prices </a>
</li>
<li class="nav-item active">
<a class="nav-link" href="testimonials.php">Testimonials </a>
</li>
<li class="nav-item active">
<a class="nav-link" href="terms-conditions.php">T&C </a>
</li>
<li class="nav-item active">
<a class="nav-link" href="contact.php">Contact </a>
</li>
</ul>
</div>
</nav>
</div>
</div>
</div>
A solution could be to create a new class that you will add to your header and content like so:
.bodyWidth {
width: 80%;
margin-left: auto;
margin-right: auto;
}
Add max-with:{{size second box}} to hh class
or
put both box into a container class.
<div class="container">
//first box
//second box
</div>

Bootstrap sliders text overlay is disabling nav links

I have used a bootstrap slider with text overlay and it is disabling the nav bar when I scroll down the page. When the text is level with the nav bar which is fixed, the links are disabled
Not sure if it is a bootstrap bug as I have used other sliders in the past which seem fine. The only think it that is is a one page website with many sections so the navbar needs to be fixed
<!------------NavigationBar------------>
<section id="nav-bar">
<nav class="navbar navbar-expand-lg navbar-light">
<a class="navbar-brand" href="#"><img src="img/logo1.png" alt=""></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#top">HOME</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">ABOUT US</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#services">SERVICES</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#team">OUR TEAM</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#price">PRICE PLANS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#testimonials">TESTIMONIALS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">CONTACT</a>
</li>
</ul>
</div>
</nav>
</section>
<!------------Slider------------>
<div id="slider">
<div id="headerSlider" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#headerSlider" data-slide-to="0" class="active"></li>
<li data-target="#headerSlider" data-slide-to="1"></li>
<li data-target="#headerSlider" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="img/img1.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption">
<h5>Business Consultants Is Who We Are</h5>
</div>
</div>
<div class="carousel-item">
<img src="img/img2.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption">
<h5>Create A Business Niche</h5>
</div>
</div>
<div class="carousel-item">
<img src="img/img3.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption">
<h5>Business Plan Support</h5>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#headerSlider" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#headerSlider" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
/*-----------Navigation----------*/
#nav-bar{
position: fixed;
width: 100%;
top: 0;
z-index: 10;
}
.navbar-brand img{
height: 80px;
padding-left: 30px;
}
.navbar-nav li{
padding: 0 10px;
}
.navbar-nav li a{
float: right;
text-align: left;
}
#nav-bar ul li a:hover{
color: #586949!important;
}
.navbar{
background: #fff;
}
.navbar-toggle{
border: none!important;
}
.nav-link{
color:green!important;
font-weight: 600;
font-size: 16px;
}
/*-----------Slider----------*/
#slider{
width: 100%;
background-color:rgba(255,0,0,0.1);
}
/*.carousel-item img{
height: 800px;
}*/
.carousel-caption{
top: 50%;
transform: translateY(-50%);
bottom: initial!important;
}
.carousel-caption h5{
color: #fff;
font-size: 40px;
font-weight: bold;
}

Badge increases navbar height

I have the following HTML for a bootstrap navbar.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-top: 33px;
padding-bottom: 20px;
}
.body {
font-size: 16px;
border-spacing: 2px;
border-collapse: separate;
text-align: center;
}
.body a {
text-decoration: underline;
}
.navbar-fixed-top {
background-color: #5b5b5b;
min-height: 33px;
border-style: none;
}
.navbar-toggle {
margin-top: 2px;
margin-bottom: 2px;
padding-top: 7px;
padding-bottom: 7px;
}
.navbar-nav>li>a {
line-height: 3px;
padding-top: 16px;
padding-bottom: 14px;
}
div.navbar-header>img {
height: 30px;
margin-top: 2px;
}
.nav>li>a {
font-size: medium;
font-family: "Helvetica Bold", sans-serif;
/*font-weight: bold;*/
text-transform: uppercase;
}
.navbar-inverse .navbar-nav>li>a {
color: #f0eed0;
}
.navbar-inverse .navbar-nav>li>a:hover {
color: #f8dc54;
}
.nav li {
display: inline;
}
#vugraph-menu.inprogress>a {
color: black;
background-color: #ecbe23;
}
#vugraph-menu.inprogress>a:hover,
#vugraph-menu.inprogress.open>a:not(:hover) {
color: white;
}
</style>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<img src="http://www.bridgebase.com/images/bbo_red.png">
<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>
</div>
<div id="navbar" class="nav navbar-collapse collapse">
<div class="container">
<ul class="nav navbar-nav">
<li id="vugraph-menu" class="nav-item dropdown" title="No tables in play">
<a id="navbar-vugraph-menu-link" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Vugraph <span id="vugraph-count" class="badge badge-notify"></span></a>
<ul class="dropdown-menu" aria-labelledby="navbar-vugraph-menu-link">
<li class="dropdown-item">Watch</li>
<li class="dropdown-item">Schedule</li>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="//www.bridgebase.com/myhands/index.php" target="_blank">Hand Records</a></li>
<li class="nav-item"><a class="nav-link" href="//www.bridgebase.com/points/index.php" target="_blank">Masterpoints</a></li>
<li class="nav-item"><a class="nav-link" href="https://www.bridgebase.com/purchase/pay.php" target="_blank">BB$</a></li>
</ul>
</div>
</div>
</div>
</nav>
With no badge this looks like:
I have JavaScript that dynamically fills in the #vugraph-count badge. When it has contents, the height of the navbar increases by more than 15 pixels. The HTML becomes:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-top: 33px;
padding-bottom: 20px;
}
.body {
font-size: 16px;
border-spacing: 2px;
border-collapse: separate;
text-align: center;
}
.body a {
text-decoration: underline;
}
.navbar-fixed-top {
background-color: #5b5b5b;
min-height: 33px;
border-style: none;
}
.navbar-toggle {
margin-top: 2px;
margin-bottom: 2px;
padding-top: 7px;
padding-bottom: 7px;
}
.navbar-nav>li>a {
line-height: 3px;
padding-top: 16px;
padding-bottom: 14px;
}
div.navbar-header>img {
height: 30px;
margin-top: 2px;
}
.nav>li>a {
font-size: medium;
font-family: "Helvetica Bold", sans-serif;
/*font-weight: bold;*/
text-transform: uppercase;
}
.navbar-inverse .navbar-nav>li>a {
color: #f0eed0;
}
.navbar-inverse .navbar-nav>li>a:hover {
color: #f8dc54;
}
.nav li {
display: inline;
}
#vugraph-menu.inprogress>a {
color: black;
background-color: #ecbe23;
}
#vugraph-menu.inprogress>a:hover,
#vugraph-menu.inprogress.open>a:not(:hover) {
color: white;
}
</style>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<img src="http://www.bridgebase.com/images/bbo_red.png">
<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>
</div>
<div id="navbar" class="nav navbar-collapse collapse">
<div class="container">
<ul class="nav navbar-nav">
<li id="vugraph-menu" class="nav-item dropdown" title="No tables in play">
<a id="navbar-vugraph-menu-link" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Vugraph <span id="vugraph-count" class="badge badge-notify">1</span></a>
<ul class="dropdown-menu" aria-labelledby="navbar-vugraph-menu-link">
<li class="dropdown-item">Watch</li>
<li class="dropdown-item">Schedule</li>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="//www.bridgebase.com/myhands/index.php" target="_blank">Hand Records</a></li>
<li class="nav-item"><a class="nav-link" href="//www.bridgebase.com/points/index.php" target="_blank">Masterpoints</a></li>
<li class="nav-item"><a class="nav-link" href="https://www.bridgebase.com/purchase/pay.php" target="_blank">BB$</a></li>
</ul>
</div>
</div>
</div>
</nav>
and the rendered navbar looks like:
(I had to put our custom CSS inline in the HTML box of the snippet, because otherwise bootstrap.min.css was taking priority over the custom styles.) You'll need to use the "Full page" option of the stack snippets to get the non-collapsed navbar.
The problem appears to be related to the .navbar-nav>li>a style line-height: 3px. When I remove that, the navbar is always too tall. This is being used to reduce the navbar height to match the logo on the left. For some reason, when the badge is added, it's overriding this (although it's not striked out in the DOM inspector).
The badge is not causing the problem, you can check next example with two navbars (one with badge filled with a number, other without it) where both have similar height (like Chris Bar already noted). So:
1) It could be a problem with some of your custom CSS, in this case, I recommend to use the inspector tool to check what style is added to your badge or navbar.
2) Another thing you could do is check if you have a well structured navbar as explained on Bootstrap Navbar.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<!-- Brand and collapse button -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar1">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Navbar 1</a>
</div>
<div id="navbar1" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li id="vugraph-menu" class="nav-item dropdown" title="No tables in play">
<a id="navbar-vugraph-menu-link" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Vugraph
<span id="vugraph-count" class="no-padding badge badge-notify">99</span>
</a>
<ul class="dropdown-menu" aria-labelledby="navbar-vugraph-menu-link">
<li class="dropdown-item">
Watch
</li>
<li class="dropdown-item">
Schedule
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="//www.bridgebase.com/myhands/index.php" target="_blank">Hand Records</a>
</li>
<li class="nav-item">
<a class="nav-link" href="//www.bridgebase.com/points/index.php" target="_blank">Masterpoints</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.bridgebase.com/purchase/pay.php" target="_blank">BB$</a>
</li>
</ul>
</div>
</div>
</nav>
<nav class="navbar navbar-inverse navbar-fixed-bottom">
<div class="container">
<!-- Brand and collapse button -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar2">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Navbar 2</a>
</div>
<div id="navbar2" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li id="vugraph-menu" class="nav-item dropdown" title="No tables in play">
<a id="navbar-vugraph-menu-link" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Vugraph
<span id="vugraph-count" class="no-padding badge badge-notify"></span>
</a>
<ul class="dropdown-menu" aria-labelledby="navbar-vugraph-menu-link">
<li class="dropdown-item">
Watch
</li>
<li class="dropdown-item">
Schedule
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="//www.bridgebase.com/myhands/index.php" target="_blank">Hand Records</a>
</li>
<li class="nav-item">
<a class="nav-link" href="//www.bridgebase.com/points/index.php" target="_blank">Masterpoints</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.bridgebase.com/purchase/pay.php" target="_blank">BB$</a>
</li>
</ul>
</div>
</div>
</nav>
Finally, I don't believe that updating to Bootstrap 4 will help here, indeed, you will have to port your entire site to the new version because there are thing that changed from version 3 to 4 (Read more here).
Update
After the question was updated with the custom style applied on the elements, a possible solution is to add next style to the badge:
{line-height: 0; display: inline;}
Example:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
/* Move down content because we have a fixed navbar that is 50px tall */
#vugraph-count {
line-height: 0;
display: inline;
}
body {
padding-top: 33px;
padding-bottom: 20px;
}
.body {
font-size: 16px;
border-spacing: 2px;
border-collapse: separate;
text-align: center;
}
.body a {
text-decoration: underline;
}
.navbar-fixed-top {
background-color: #5b5b5b;
min-height: 33px;
border-style: none;
}
.navbar-toggle {
margin-top: 2px;
margin-bottom: 2px;
padding-top: 7px;
padding-bottom: 7px;
}
.navbar-nav>li>a {
line-height: 3px;
padding-top: 16px;
padding-bottom: 14px;
}
div.navbar-header>img {
height: 30px;
margin-top: 2px;
}
.nav>li>a {
font-size: medium;
font-family: "Helvetica Bold", sans-serif;
/*font-weight: bold;*/
text-transform: uppercase;
}
.navbar-inverse .navbar-nav>li>a {
color: #f0eed0;
}
.navbar-inverse .navbar-nav>li>a:hover {
color: #f8dc54;
}
.nav li {
display: inline;
}
#vugraph-menu.inprogress>a {
color: black;
background-color: #ecbe23;
}
#vugraph-menu.inprogress>a:hover,
#vugraph-menu.inprogress.open>a:not(:hover) {
color: white;
}
</style>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<img src="http://www.bridgebase.com/images/bbo_red.png">
<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>
</div>
<div id="navbar" class="nav navbar-collapse collapse">
<div class="container">
<ul class="nav navbar-nav">
<li id="vugraph-menu" class="nav-item dropdown" title="No tables in play">
<a id="navbar-vugraph-menu-link" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Vugraph <span id="vugraph-count" class="badge badge-notify">1</span></a>
<ul class="dropdown-menu" aria-labelledby="navbar-vugraph-menu-link">
<li class="dropdown-item">Watch</li>
<li class="dropdown-item">Schedule</li>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="//www.bridgebase.com/myhands/index.php" target="_blank">Hand Records</a></li>
<li class="nav-item"><a class="nav-link" href="//www.bridgebase.com/points/index.php" target="_blank">Masterpoints</a></li>
<li class="nav-item"><a class="nav-link" href="https://www.bridgebase.com/purchase/pay.php" target="_blank">BB$</a></li>
</ul>
</div>
</div>
</div>
</nav>
Check out this quick test that measures the height of the nav items with and without a badge. There is a small difference, but not much. only 0.04 pixels.
You might have other CSS that is interfering and makes the badge a bit taller. If the padding or line-height of the .badge is made smaller, then the two nav items have the same height. See the commented out CSS code, uncommenting this fixes the issue in the demo here
document.querySelectorAll('.nav-item').forEach((el) => {
console.log(el.innerText + ' Height: ' + el.getBoundingClientRect().height + 'px')
});
.nav-item {
border: 1px solid red;
}
.nav-item .badge {
/*line-height: 90%;*/
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" />
<div id="navbar" class="nav navbar-collapse">
<div class="container">
<ul class="nav navbar-nav">
<li class="nav-item dropdown" title="No tables in play">
<a id="navbar-vugraph-menu-link" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">No Badge</a>
</li>
<li class="nav-item dropdown" title="No tables in play">
<a id="navbar-vugraph-menu-link" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Has Badge <span id="vugraph-count" class="badge badge-notify">1</span></a>
</li>
</ul>
</div>
</div>

How I do to fix the hover?

The hover is not covering all the height of the link, How I do to fix the hover?
I know that the combination of colors is not correct but is only for testing*
I'm using Bootstrap 4.3.1
.navbar .collapse ul li{
}
.navbar .collapse ul li a{
font-family: 'Comfortaa', cursive;
font-size: 20px;
color: skyblue !important;
}
.navbar .collapse ul li a:hover{
background-color: deepskyblue;
height: 100%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<a class="navbar-brand mx-5" href="#">
<img src="Resources/Images/bootstrap-solid.svg" width="30" height="30" alt="">
</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 ml-auto mx-3">
<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="#">News</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Services</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</div>
</nav>
Your first div's .navbar class is adding padding. That's why the hover is not displaying like you want.
FIX: Remove padding (top & bottom) by adding this CSS
.navbar {
padding: 0 1rem;
}

Resources