請參閱附件圖片,我想在html中設計,相當成功。但是當我在不同的分辨率下測試它時,紅色的盒子在這裏和那裏移動。我在100%的寬度和高度100%CSS問題重疊圖片
<style type="text/css">
#green-box { width: 75%; background: green; float: left; position: relative; height: 100%; overflow: visible; position: relative; }
#blue-box { width: 25%; background: blue; float: left; height: 100%; }
#red-box {
position: relative;
top: 50px;
left:450px;
width: 357px;
background: red;
height: 207px;
margin:0 auto;
}
#green-box-content
{
margin:0 auto;
width:1600px;
height:800px;
}
</style>
<div id="container">
<div id="green-box">
<div id="green-box-content">
<p>Here is some text!</p>
<div id="red-box"></div>
</div>
</div>
<div id="blue-box">
</div>
<div style="clear: both"></div>
</div>
Best,Thanks.Thats我缺少的東西 – user2451541
但是,如果我將藍色和綠色框的高度延伸到100%,紅色框消失 – user2451541
我需要知道其周圍的代碼的其餘部分以幫助,因爲設置高度到100%取決於聲明高度的父元素。瞭解您正在查看的瀏覽器也是有幫助的。 –