首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

一个DIV隐藏后,其它DIV怎么填上去?

2012-02-14 
一个DIV隐藏后,其它DIV如何填上去??我有四个DIV,排列如:1234现在假设1被隐藏了,2就应该填补上来.变成:234

一个DIV隐藏后,其它DIV如何填上去??
我有四个DIV,排列如:
12
34
现在假设1被隐藏了,2就应该填补上来.变成:
23
4
这个怎么实现啊?
请大虾们帮帮忙吧.在线等~~~急啊~~~~~

[解决办法]
好实现的 设置你的这四个div的样式float:left;就可以了,闲着没事,给你做个示例吧.
<div style="width:100px; margin:auto;">
<div id="div1" style="width:50px; float:left; background:Green;">1</div>
<div style="width:50px; float:left; background:Blue;">2</div>
<div style="width:50px; float:left; background:Red;">3</div>
<div style="width:50px; float:left; background:Yellow;">4</div>
<div style="clear:both;"></div>
</div>
<input type="button" value="隐藏1" onclick="document.getElementById('div1').style.display='none';" />

热点排行