title: How do I center elements in a div or nav element?
body: <p>This is my navigation bar:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#main-nav-bar .nav-item {
    display: inline-block;
    padding: 0.5%;
    border-right: 1px solid white;
  }
  #main-nav-bar a {
    text-decoration: none;
    color: #CFCFE0;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;nav id="main-nav-bar"&gt;
    &lt;a href="#Services" class="nav-tab nav-item selected"&gt;Services&lt;/a&gt;
    &lt;a href="#Resources" class="nav-tab nav-item"&gt;Resources&lt;/a&gt;
    &lt;a href="#Contact-Us" class="nav-tab nav-item"&gt;Contact Us&lt;/a&gt;
    &lt;a href="#Company" class="nav-tab nav-item"&gt;Company&lt;/a&gt;
  
    &lt;form class="searchbar nav-item" action="http://www.google.com/search" name="f" target="_blank"&gt;
      &lt;input size="10" name="q" value="" class="searchform"&gt;&amp;nbsp;
      &lt;input type="submit" value="Go!" name="btnG" class="searchbutton"&gt;
      &lt;br&gt;
    &lt;/form&gt;
  &lt;/nav&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I want to center the 5 items inside the <code>nav</code> element in a responsive way. 
  I tried to set the <code>margin</code>s,  but that is still not perfect centering.</p>
  
  <p>How do I center them ?</p>