そのようなコード:
<html>
<head>
<style type="text/css">
html, body {height:100px; width:200px}
body {margin:0}
</style>
</head>
<body>
<div style="background:red; height:100%">
<div style="background:green; height:100%; width:50px;">
</div>
<div style="background:yellow; height:100%;">
</div>
</div>
</body>
</html>
すべてのブラウザーで、2 番目にネストされた DIV が親 DIV の外に表示されるようにします。
ここで、ネストされたすべての DIV が親 DIV 内に表示されることを期待しています。
親 DIV のサイズに関係なく、黄色の DIV が残りの幅を埋めるようにします。
html, body {height:100px; width:200px}
まともなサイズのスクリーンショットを作成するためだけに作成されていることに注意してください。そのはずhtml, body {height:100%; width:200%}
アップデート
のコードdisplay: inline-block
:
<div style="background:red; height:100%">
<div style="background:green; height:100%; width:50px; display:inline-block;">
</div>
<div style="background:yellow; height:100%; display:inline-block;">
lalala
</div>
</div>
生産する