Navbar items are not aligning on right hand side

14 Views Asked by At

This is my code for navbar in base.html file in a django project. I am trying to align Logout , login and register urls on rhs of the navbar. I am using Bootstarp4. Even after using the right classes they all are not aligned to the rhs of the navbar. This is my code :-

       **   <!-- Navbar Right Side -->**
          <div class="navbar-nav ml-auto">
            {% if user.is_authenticated %}
               <a class="nav-item nav-link" href="{%url 'profile'%}">Profile</a>
              <form action="{% url 'logout' %}" method="post">
                {% csrf_token %}
                <button type="submit" class="btn btn-link text-white" style="text-decoration: none;">Logout</button>
              </form>
            {%else%}
              <a class="nav-item nav-link" href="{%url 'login'%}">Login</a>
              <a class="nav-item nav-link" href="{%url 'register'%}">Register</a>
            {%endif%}
          </div>

        

I tried using the ml_auto class but even then contents were not aligned to the right-hand side of the navbar.

0

There are 0 best solutions below