title: Bootstrap 4 navbar right align with button that doesn't collapse on mobile
body: <p>I am trying to have 3 elements on a navbar. A left aligned brand, a right aligned group of links that collapse on mobile, and an additional button that is also right aligned like the links, but should not collapse with them. </p>
  
  <p>To right align the button and links I wrapped them in ml-auto div. This works great on mobile (1st image), but on PC the button appears above the links (2nd image). I tried to add btn-group to the div which sort of works, but the button merges with links and it looks odd (3rd image). </p>
  
  <p><a href="https://i.stack.imgur.com/cgun9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cgun9.jpg" alt="navbar on mobile, desktop and button group"></a></p>
  
  <p>How can I properly align these components horizontally?</p>
  
  <p>Please note that I do not want the button to be in the same group with the other right links. I want the button to be always visible even on a small screen. I've seen a few similar questions on SO, but they all have the right aligned items in the same, collapsible group which is no good for me. </p>
  
  <p>You can paste the code below to <a href="https://www.w3schools.com/bootstrap4/tryit.asp?filename=trybs_navbar_form&amp;stacked=h" rel="nofollow noreferrer">w3school TryIt editor</a></p>
  
  <pre><code>&lt;nav class="navbar navbar-expand-sm bg-dark navbar-dark"&gt;
     &lt;a class="navbar-brand" href="#"&gt;Home&lt;/a&gt;
  
  
  &lt;div class="ml-auto"&gt;
              &lt;button class="btn btn-success"&gt;My Button&lt;/button&gt;
  
              &lt;button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"&gt;
                &lt;span class="navbar-toggler-icon"&gt;&lt;/span&gt;
              &lt;/button&gt;
  
              &lt;div class="collapse navbar-collapse" id="navbarSupportedContent"&gt;
                  &lt;ul class="navbar-nav mr-auto"/&gt;
                  &lt;ul class="navbar-nav ml-auto"&gt;
                      &lt;li class="nav-item active"&gt;
                          &lt;a class="nav-link" href="#"&gt;Right Link 1&lt;/a&gt;
                      &lt;/li&gt;
                      &lt;li class="nav-item active"&gt;
                          &lt;a class="nav-link" href="#"&gt;Right Link 2&lt;/a&gt;
                      &lt;/li&gt;
  
                  &lt;/ul&gt;
          &lt;/div&gt;
  &lt;/nav&gt;
  </code></pre>