There is now a much simpler solution than when this question was originally asked, five years ago. CSS Flexbox allows you to initially request the location of two columns. This is the bare equivalent of the table in the original question:
<div style="display: flex"> <div>AAA</div> <div>BBB</div> </div>
One of the nice things about Flexbox is that it allows you to easily determine how children should shrink and grow in order to adapt to the size of the container. In the above example, I will expand to make the field the full width of the page, make the left column at least 75 pixels wide and grow the right column to capture the remaining space. I will also pull the style into my own block, assign some background colors so that the columns are obvious, and add legacy Flex support for some older browsers.
<style type="text/css"> .flexbox { display: -ms-flex; display: -webkit-flex; display: flex; width: 100%; } .left { background: #a0ffa0; min-width: 75px; flex-grow: 0; } .right { background: #a0a0ff; flex-grow: 1; } </style> ... <div class="flexbox"> <div class="left">AAA</div> <div class="right">BBB</div> </div>
Flex is relatively new, and therefore, if you are stuck with support for IE 8 and IE 9, you cannot use it. However, at the time of this writing, http://caniuse.com/#feat=flexbox indicates at least partial support for browsers using 94.04% of the market.
twm May 16 '16 at 2:23 pm 2016-05-16 14:23
source share