I am using bootstrap, I’m still learing css and bootstrap. I would like to move links in ul to the far right of the screen. Please help
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" routerLink="/home">
<img src="../assets/images/My project (1).png" width="40" height="20" class="d-inline-block align-top" 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">
<div class="mr-auto"></div>
<ul class="navbar-nav my-2 my-lg-0">
<li class="nav-item active"><a class="nav-link" routerLink="/home">Home<span class="sr-only">(current)</span></a></li>
<li class="nav-item"><a class="nav-link" routerLink="/property">Property<span class="sr-only">(current)</span></a></li>
<li class="nav-item"><a class="nav-link" routerLink="/about">About<span class="sr-only">(current)</span></a></li>
</ul>
</div>
</nav>
I tried justify content:right
but it didnt work. I also tried text-end class but it doesn’t work. I also tried to use justify-content: space-between;
and it didn’t work
2
Answers
You may use the following code:
Hope you find this useful! Anything else please let me know in comments.
You can just apply
margin-left: auto
to yourul
to move them to the right end.