title: Adding elements to sides of centered element without changing alignment
body: <p>I have a dynamically created header on a page. Sometimes, there are left and right buttons to the sides of it, sometimes only left or right, and sometimes none.</p>
  
  <p>Is there a way to center the main text and keep it centered when adding other elements next to it? Currently, when I add the left/right buttons, the whole assembly is centered. If I only add one button, the whole thing is shifted off to one side.</p>
  
  <p><strong>How do I keep the main element centered but add other elements around it?</strong></p>
  
  <hr>
  
  <p>This works fine:</p>
  
  <pre><code>&lt;h1&gt;
    &lt;img src="left.png" /&gt;
    Main Title
    &lt;img src="right.png" /&gt;
  &lt;/h1&gt;
  </code></pre>
  
  <p>This doesn't work:</p>
  
  <pre><code>&lt;h1&gt;
    &lt;img src="left.png" /&gt;
    Main Title
  &lt;/h1&gt;
  </code></pre>