title: Flexbox margin-right: auto not working, if I use display:none in one element
body: <p>I would like remove one item in flexbox with <code>display:none</code>, and I would like set align right (with <code>margin-right: auto</code>) to <code>logo</code> class item, from class <code>nav</code>. But if I use <code>display:none</code>, then <code>margin-right: auto</code> not working. What's wrong? Maybe another solution instead of <code>display:none</code>?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>* {
      margin: 0;
      padding: 0;
  }
  
  body {
      background: white;
  }
  
  /*
  ---------------------------
  ----------Flexbox----------
  ---------------------------
  */
  
  .container {
      border: 1px solid red;
  }
  
  .header {
      display: flex;
      flex-direction: row;
      height: 80px;
  }
  
  .menubtn {
      align-self: center;
      margin-left: 20px;
      font-size: 20px;
      margin-right: auto;
  }
  
  .logo {
      align-self: center;
      margin-right: 40px;
  }
  
  .nav {
      background: #000;
      color: #FFF;
      position: fixed;
      top: 0;
      left: 0;
      height: 100%;
      width: 0%;
      opacity: 0;
      text-align: center;
      overflow-x: hidden;
      list-style: none;
      transition: .5s;
      border: 1px solid blue;
  }
  
  .closebtn {
      text-align: left;
      margin-left: 30px;
      margin-top: 30px;
  }
  
  .nav-item {
      font-size: 1.8em;
  }
  
  .nav-item:nth-child(1n+2) {
      margin-top: 3em;
  }
  
  
  
  /*
  ---------------------------
  --------Responsive---------
  ---------------------------
  */
  
  @media (min-width: 640px) {
  
      .closebtn {
          display: none;
      }
  
      .menubtn {
          display: none;
      }
  
      .nav {
          transition: 0;
          background: none;
          color: #000;
          display: flex;
          flex-direction: row;
          align-items: center;
          position: static;
          opacity: 1;
          font-size: 0.8em;
          width: auto;
          margin-right: auto;
      }
  
      .nav-item:nth-child(1n+2) {
          margin-left: 10px;
      }
  
      .nav-item:nth-child(1n+2) {
          margin-top: 0;
      }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;title&gt;Mineral Fever&lt;/title&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;link rel="stylesheet" href="main.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class="container"&gt;
          &lt;header&gt;
              &lt;div class="header"&gt;
                  &lt;p class="menubtn" onclick="openNav()"&gt;&amp;#9776;&lt;/p&gt;
                  &lt;nav&gt;
                      &lt;ul id="nav" class="nav"&gt;
                          &lt;li class="nav-item closebtn" onclick="closeNav()"&gt;&amp;times;&lt;/li&gt;
                          &lt;li class="nav-item"&gt;Termékek&lt;/li&gt;
                          &lt;li class="nav-item"&gt;Kapcsolat&lt;/li&gt;
                          &lt;li class="nav-item"&gt;Szállítás&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/nav&gt;
                  &lt;h1 class="logo"&gt;Mineral Fever&lt;/h1&gt;
              &lt;/div&gt;
          &lt;/header&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;script src="main.js"&gt;&lt;/script&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>