Hey there! I currently have a centralized navbar layout for Desktop. However, my aim is to also center it on the mobile version.
Basically, this navigation bar appears when scrolled downwards with icons like this. Therefore, I'm looking for assistance in understanding how to position the navbar toggler in the center across all instances of the website, even upon clicking it (similar to here)
I've set up a simplified Jfiddle here
Alternatively, you can review the code below:
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<style>
body {
background-color: lightblue;
margin-top: 100px;
color: black;
}
.center {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.navbar-collapse {
-ms-flex-pack:center!important;
-webkit-justify-content: center!important;
justify-content:center!important;
}
.fa {
font-size: 2.5rem;
}
.sticky {
position: fixed;
top: 0;
font-weight: 500;
width: 100%;
z-index: 1000;
padding: .5rem;
}
</style>
<nav id="navbar" class="navbar navbar-expand-lg navbar-light bg-light cl-effect-10">
<div class="container">
<a class="navbar-brand" href="#" id="logo">
<i class="fa fa-copyright" aria-hidden="true"></i>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#center-nav" aria-controls="center-nav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="center-nav">
<ul class="navbar-nav center">
<li class="nav-item">
<a class="nav-link" href="#">Link 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link 2</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link 3</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link 4</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link 5</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link 6</a>
</li>
</ul>
</div>
<div class="d-flex">
<a href="#" target="_blank" id="fb"><i class="fa fa-facebook-official" title="Facebook"></i></a>
<a href="#" target="_blank" id="ig"><i class="fa fa-instagram" title="Instagram"></i></a>
</div>
</div>
</nav>
Your advice or suggestions would be greatly appreciated. Thank you!