Home > other >  How can I move the "ul" block of navbar to the right without affecting the toggle button f
How can I move the "ul" block of navbar to the right without affecting the toggle button f

Time:02-10

I am using bootstrap NavBar ..

When trying to move the ul block to the right it disables the toggle button responsiveness ...

<head>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>

<nav >
  <div >
    <a  href="#">Rehan's Thoughts</a>
    <button  type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span ></span>
            </button>
    <div  id="navbarNav">
      <ul >
        <li >
          <a  aria-current="page" href="#">Home</a>
        </li>
        <li >
          <a  href="#">About</a>
        </li>
        <li >
          <a  href="#">Contact</a>
        </li>
        <li >
          <a >Blog</a>
        </li>
      </ul>
    </div>
  </div>
</nav>

CodePudding user response:

Add w-100(width: 100%;) to your ul element and also add justify-content-end or (justify-content: right;)

<head>
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>

<nav >
  <div >
    <a  href="#">Rehan's Thoughts</a>
    <button  type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span ></span>
            </button>
    <div  id="navbarNav">
      <ul >
        <li >
          <a  aria-current="page" href="#">Home</a>
        </li>
        <li >
          <a  href="#">About</a>
        </li>
        <li >
          <a  href="#">Contact</a>
        </li>
        <li >
          <a >Blog</a>
        </li>
      </ul>
    </div>
  </div>
</nav>

  • Related