I've been grappling with aligning the content of a nav-item inside a nav container in my project. I'm unable to apply a margin on the ul>li items as it doesn't adjust properly on different resolutions. I've tried using percentages, but nothing seems to be working for me. The desired outcome is similar to this https://i.sstatic.net/zoiQe.jpg
You can access a small demo here
Thank you very much, Andreea.
.header-nav-fixed-down {
height: 60px;
padding: 20px;
background-color: #2c3642;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.3);
}
.divider {
width: 1px;
height: 30px;
background-color: #000000;
}
div#navbarCollapse ul li a{
color: grey !important;
}
<!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 4 Navbar with hover multi dropdown</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link href="css/bootstrap-4-hover-navbar.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-md fixed-down header-nav-fixed-down ">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav m-auto">
<li class=" nav-item ">
<a href="#">ItemA</a>
</li>
<li role="separator" class="divider m-auto"></li>
</ul>
<ul class="navbar-nav m-auto">
<li class="nav-item">
<a href="#">ItemB.1</a>
</li>
<li class="nav-item">
<a href="#">ItemB.2</a>
</li>
<li class="nav-item">
<a href="#">ItemB.3</a>
</li>
<li role="separator" class="divider"></li>
</ul>
<ul class="navbar-nav m-auto">
<li class="nav-item">
<a href="#">ItemB.1</a>
</li>
<li class="nav-item">
<a href="#">ItemB.2</a>
</li>
<li class="nav-item">
<a href="#">ItemB.3</a>
</li>
<li role="separator" class="divider"></li>
</ul>
<ul class="navbar-nav m-auto">
<li class="nav-item">
<a href="#">ItemD</a>
</li>
<li role="separator" class="divider"></li>
</ul>
<ul class="navbar-nav m-auto">
<li class="nav-item">
<a href="#">ItemE1</a>
</li>
<li class="nav-item">
<a href="#">ItemE2</a>
</li>
<li role="separator" class="divider"></li>
</ul>
<ul class="navbar-nav m-auto">
<li class="nav-item ">
<a href="#">ItemF1</a>
</li>
<li class="nav-item ">
<a href="#">ItemF2</a>
</li>
<li role="separator" class="divider"></li>
</ul>
</div>
</nav>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<script src="js/bootstrap-4-hover-navbar.js"></script>
</body></html>