我有主容器940像素股利中心問題
用的寬度250像素每
與主容器我想這些框爲中心對準主容器內的div 2。然而問題是第二個div動態添加。所以如果第二個div不在那裏,第一個div應該居中。當第二個div被添加時,兩者都應該按照940 px主div進行聆聽。
我嘗試了很多,但無法找到解決方案。請幫忙!
下面是簡化的代碼
CSS
div.box {
background: #EEE;
height: 400px;
width: 940px;
}
div.left {
background: #999;
float: left;
height: 390px;
width: 250px;
}
div.right {
background: #666;
height: 390px;
width: 250px;
float: left;
}
div.clear {
clear: both;
}
HTML
<div class="box">
<div class="left">Tree</div>
<div class="right">View</div> (this div will dynamically add)
<div class="clear" />
</div>
感謝
你的源代碼在哪裏? here image not display – falguni
我無法發佈圖片,所以我編輯了我的評論。添加了參考代碼。 –