Bootstrap 5 – Navbar button align ment

I’m trying to setup a navbar with the offcanvas menu and would like to remove the included branding element on the left of it so, when I remove it bootstrap automatically aligns the nav’s menu button back to the left, but I want to keep it on the right. Anyone know how I can fix this ?

<!doctype html>
<html lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="style.css">


    <nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
      <div class="container-fluid">
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        <div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasNavbar" aria-labelledby="offcanvasNavbarLabel">
          <div class="offcanvas-header">
            <h5 class="offcanvas-title" id="offcanvasNavbarLabel">MENU</h5>
            <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
          <div class="offcanvas-body">
            <ul class="navbar-nav justify-content-center flex-grow-1">
              <li class="nav-item">
                <a class="nav-link"href="#">Home</a>
              <li class="nav-item">
                <a class="nav-link" href="#">Link</a>

    <script src="" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>

>Solution :

Adding the class ‘ms-auto’ to the button should push it to the right.

Leave a Reply