如果你想有一個CSS這裏唯一的解決辦法是你應該做的:
- 添加
position:relative;
和margin:0
到<body>
元素。
添加下一個元素作爲第一元素在你的<body>
:
<div style="position:absolute; left:0; top:0; width:100%; height:100%; overflow:hidden;">
移動<div class="botleft ...">
和<div class="botright ...">
元素,該專區。
通過應用position:relative
到<body>
元素,並增加它的另一個元素與position:absolute; left:0; top:0; width:100%; height:100%
你告訴該元素「跟蹤」 <body>
元素的大小。並通過添加overflow:hidden;
隱藏底部溢出的圖像。
該解決方案的缺點是,您可能會在頁面底部看到剪切圖像。好了,沒有什麼是完美的:)
這是你的DOM樹應該如何看待這樣的變化之後
要馬上看到結果,你可以從瀏覽器的控制檯運行下面的代碼:
d = document.createElement("div");
d.style.cssText = "position:absolute; left:0; top:0; width:100%; height:100%; overflow:hidden;";
document.body.insertBefore(d, document.body.firstChild);
d.appendChild(document.getElementsByClassName("botleft")[0]);
d.appendChild(document.getElementsByClassName("botright")[0]);
document.body.style.position = "relative";
document.body.style.margin = "0";
如果你想讓所有的內容都以簡潔的格式顯示,你肯定會需要用JavaScript來擴展它們。 – 2013-03-24 21:22:27