| <!DOCTYPE html> |
| <html> |
| <body style="zoom: 1.1;"> |
| <div id="test" style="height: 100px;"> |
| <div id="red" style="width: 212px; height: 100px; background:red; float: left;"></div> |
| <div id="blue" style="height: 100px; background: blue; float: left;"></div> |
| </div> |
| <script> |
| var testContainer = document.getElementById('test'); |
| var w = document.body.getBoundingClientRect().width; |
| w = 913.0908660888672; |
| testContainer.style.width = w + 'px'; |
| testContainer.children[1].style.width = (w - testContainer.children[0].getBoundingClientRect().width) + 'px'; |
| </script> |
| </body> |
| </html> |