title: Split available width between two divs
body: <p>I have a container (width is not known) containing four divs, as follows:</p>
  
  <pre><code>| Div1 | Div2 ............... | .............. Div3 | Div4 |
  </code></pre>
  
  <p>The leftmost and rightmost divs (Div1/Div4) are fixed width; that's the easy part.</p>
  
  <p>The width of Div2/Div3 is not known, and I would like to avoid setting a fixed width for them, as depending on the content one can be much wider than the other (so I cannot just e.g. have each one use 50% of the available space)</p>
  
  <p>I would like the width of Div2/Div3 to be automatically computed by the browser, then if there is any remaining space left, they should stretch to fill any remaining space (it does not matter how the remaining space is split between Div2/Div3)</p>
  
  <p>The way I am approaching this right now is:</p>
  
  <ul>
  <li>Div1 floated left (or absolutely positioned)</li>
  <li>Div4 floated right (or absolutely positioned)</li>
  <li>Div2 has a margin-left equal to the width of Div1 (known)</li>
  <li>Div3 has a margin-right equal to the width of Div4 (known)</li>
  </ul>
  
  <p>My question is, how to have Div2 and Div3 stretch to fill the remaining available width? I guess one option would be to use display: table, and another possibility would be <a href="http://caniuse.com/flexbox" rel="noreferrer" title="flex-box">flex-box</a>. Are there any alternatives?</p>
  
  <p><strong>Update:</strong> Edited for clarity.</p>
  
  <p><strong>Update 2:</strong> Please note that <em>I cannot assume that Div2 and Div3 should each get 50% of the available space</em>. This is explicitly stated in the question but somehow I keep getting answers based on this assumption.</p>