title: html - Bootstrap navbar - How to align items left and right
body: <p>i am making some new efforts with Bootstrap in Angular. I implemented a template navbar into my <code>html-site</code> from Bootstrap. The navbar contains some items in an orderd list and a search button and relating form. I want to align the text items on the left side and the search button and input form on the right side.</p>
  
  <p>I tried things like : <code>nav navbar-nav navbar-left</code> from this question:
  [<a href="https://stackoverflow.com/questions/19733447/bootstrap-navbar-with-left-center-and-right-aligned-items][1]">Bootstrap NavBar with left, center and right aligned items</a>.
  But this didn't helped.</p>
  
  <p>Does anyone have an idea how to align the elements on right and left side?
  Thank you so far.</p>
  
  <p>The <code>html-code</code>:</p>
  
  <pre><code>&lt;nav class="navbar navbar-expand-lg navbar-light bg-light"&gt;
    &lt;!-- &lt;a class="navbar-brand" href="#"&gt;Navbar&lt;/a&gt; --&gt;
    &lt;button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"&gt;
      &lt;span class="navbar-toggler-icon"&gt;&lt;/span&gt;
    &lt;/button&gt;
  
    &lt;div class="navbar-collapse collapse" id="navbarSupportedContent"&gt;
      &lt;ul class="nav navbar-nav navbar-left" id="text"&gt;
        &lt;li class="nav-item active"&gt;
          &lt;a class="nav-link" href="#"&gt;Home &lt;span class="sr-only"&gt;(current)&lt;/span&gt;&lt;/a&gt;
        &lt;/li&gt;
        &lt;li class="nav-item"&gt;
          &lt;a class="nav-link" href="#"&gt;Link&lt;/a&gt;
        &lt;/li&gt;
        &lt;li class="nav-item dropdown"&gt;
          &lt;a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"&gt;
            Dropdown
          &lt;/a&gt;
          &lt;div class="dropdown-menu" aria-labelledby="navbarDropdown"&gt;
            &lt;a class="dropdown-item" href="#"&gt;Action&lt;/a&gt;
            &lt;a class="dropdown-item" href="#"&gt;Another action&lt;/a&gt;
            &lt;div class="dropdown-divider"&gt;&lt;/div&gt;
            &lt;a class="dropdown-item" href="#"&gt;Something else here&lt;/a&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class="nav-item"&gt;
          &lt;a class="nav-link" href="#"&gt;Disabled&lt;/a&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;form class="form-inline my-2 my-lg-0"&gt;
        &lt;input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"&gt;
        &lt;button class="btn btn-outline-success my-2 my-sm-0" type="submit"&gt;Search&lt;/button&gt;
      &lt;/form&gt;
    &lt;/div&gt;
  &lt;/nav&gt;
  </code></pre>
  
  <p><strong>SOLUTION:</strong></p>
  
  <p>i solved the problem like this.
  I extended the width of the of the navbar to 100 %. Before that the navbar width was limited so the left/right alignment of the elements  was not possible. 
  The class <code>mr-auto</code> in the <code>&lt;ul&gt;</code>-tag just sets the margin left/right automatically.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;div class="navbar-collapse collapse navbar-adjustment" id="navbarSupportedContent"&gt;
  &lt;ul class="navbar-nav mr-auto" id="text"&gt;
  </code></pre>
  
  <p><strong>CSS:</strong></p>
  
  <pre><code>.navbar-adjustment{
      width: 100%;
  }
  </code></pre>