title: fill container with floating divs according to window size & adjust width of divs to set max
body: <p>im working on a page layout for a magazine. it now has 5 different categories - each of the categories is displayed on the main site inside a separate div floating left. so it looks like this</p>
  
  <pre><code>--------------page width-------------
  -category1--category2--category3-
  -category4--category5-
  </code></pre>
  
  <p>now i would like to have the three categories in first and second line stretch to take all the space until they reach a set amount of width and then fall back to a lower width to give more categories room in the first row on a page resize:
  (4 divs with min width does NOT fit inside the page width)</p>
  
  <pre><code>-----------------page width-----------
  -category1  --category2  --category3 -
  -category4        --category5        -
  </code></pre>
  
  <p>then on resize (as soon as 4 elements with the min-width fit in):</p>
  
  <pre><code>------------------------page width----------
  -category1--category2--category3--category4-
  -category5-
  </code></pre>
  
  <p>is this possible with css? (i don't think so) or with some javascript calculation. i tried a lot, but my java skills are just really bad ...</p>
  
  <p>thanks so much! nice greets from vienna</p>