Use specific percentages of width and float: http://jsfiddle.net/dEEW5/3/
div{ height: 100px; display:block; float:left; } .color1{ background-color: #6AC1FF; width: 80%; max-width:400px; } .color2{ background-color: #BDBCF4; width: 20%; max-width:100px; }
Use specific percentages of width with inline block: http://jsfiddle.net/dEEW5/4/
body{font-size:0} div{ height: 100px; display:inline-block; font-size:16px; } .color1{ background-color: #6AC1FF; width: 80%; max-width:400px; } .color2{ background-color: #BDBCF4; width:20%; max-width:100px; }
An inline block, where the second block falls when it can no longer be inserted into the container instead of shortening: http://jsfiddle.net/dEEW5/5/
body{font-size:0} div{ height: 100px; display:inline-block; font-size:16px; } .color1{ background-color: #6AC1FF; width: 100%; max-width:400px; } .color2{ background-color: #BDBCF4; width:100%; max-width:100px; }
source share