我有主容器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
我无法发布图片,所以我编辑了我的评论。添加了参考代码。 –