并列2列DIV,右侧DIV可隐藏,当右侧DIV隐藏时,左侧DIV自动填充到右侧。怎么实现?

 我来答
75384220
2013-09-13 · TA获得超过546个赞
知道小有建树答主
回答量:705
采纳率:0%
帮助的人:265万
展开全部
这个 最好 用 table 或者给 div 用table的 格式 div 是不能自动扩充的。
例table:
《table》
《tr》
《td》

《div》第一个《/div》

《/td》
《td》

《div》第二个《/div》
《/td》
《/tr》

《/table》
这样把第一个 td 隐藏了,第二个td 会 自动扩充。

div 的
css
<style>
html, body{
margin: 0;
height: 100%;
}
.main{
background:#ccc;
width: 100%;
height: 100%;
margin: auto;

min-width: 1000px;
}
.top_nav{
background:#ff0;
width: 100%;
height: 5%;
min-height: 30px;
}
.content{
background:blue;
width: 100%;
height: 90%;
display: table;
}
.toolbar{
background:red;
width: 10%;
height: 100%;
display: table-cell;
}
.main_container{

display: table-cell;
width: 90%;
height: 100%;
}
.ddd{
float: right;
height: 100%;
width: 220px;

}
.foot{
background:#900;
width: 100%;
height: 5%;
display: table;
}
</style>
html:
<div class="main">
<div class="top_nav">
</div>
<div class="content">
<div class="toolbar" > // 把他 隐藏 后边的 会自动 扩充
<div class="ddd"></div>
</div>

<div class="main_container"></div>
</div>
<div class="foot"></div>
</div>
why91113
2013-09-13 · TA获得超过137个赞
知道小有建树答主
回答量:72
采纳率:0%
帮助的人:109万
展开全部
<div style="width:300px;float:right;">右边的DIV</div>
<div>左边的DIV</div>
这样就OK了
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式