title: Center inline-block div in parent while ignoring floating elements
body: <p>I am trying to center an inline <code>div</code> in its parent. The parent element also has a child <code>div</code> that floats to the right. Because of the right aligned <code>div</code>, my centered <code>div</code> is shifted to the left. I want to center the middle div regardless of the position/size of the floating one like the image below with the code provided.</p>
  
  <p><img src="https://i.stack.imgur.com/N2IZV.png" alt="enter image description here"></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>.parent {
      text-align: center;
  }
  .parent div {
      display: inline-block;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="parent"&gt;
      &lt;div&gt; ... &lt;/div&gt;
      &lt;div style="float:right"&gt; ... &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The current setup has both inner divs inside the parent but I'm assuming the right way is to have the right-aligned <code>div</code> be outside with an absolute position? </p>
  
  <p>Also, I have multiple instances of the parent div on the same page.</p>
  
  <p>How can I achieve this result?</p>