Home > OS >  How i do move the content of a navbar to the right
How i do move the content of a navbar to the right

Time:10-06

I want to wrap all the list content to the right in Bootstrap 5, I tried ml-auto but it doesn't work, float-end, d-flex justify-content-end and nothing works, it helps, it is my first time on Bootstrap 5. Before it worked with ml-auto.

My code:

<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
                <div class="container-fluid">
                    <a class="navbar-brand" href="#">EXS</a>
                    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-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">
                        <li class="nav-item">
                            <a class="nav-link active" aria-current="page" href="#">Inicio</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">Examenes</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">Contacto</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">Iniciar sesión</a>
                        </li>
                        <li>
                            <a class=" btn btn-warning btn-sm my-1 text-light px-3" href="#">Regístrate</a>
                        </li>
                    </ul>
                    </div>
                </div>
                </nav>
        </div>

CodePudding user response:

If I understood what you mean, just put "ms-auto" in the <ul> tag

Result:

<ul class="navbar-nav ms-auto">
  • Related