一旦工作,那就要努力的干,聪明的干,快速的干——用省下来的时间干自己喜欢干的事情。!

2个以上div横排,后面的div出现向下移位(错位)问题解决方法

前端 lampnick 2733℃ 0评论

今天在做一个静态页面的时候出现2个以上div横排,后面的div出现向下移位(错位)的问题,在我们公司的杨哥的帮助下,解决了此问题。在此谢过。
问题如下:
效果图如下:

错位

右边的两个DIV掉下来了。

这是html部分代码:

<!--about-->
 <div class="about">
 <div class="about_main">
 <div class="about_left fl"></div>
 <div class="about_center fl">
 <div class="about_center_top">
 
 </div>
 <div class="about_center_bottom">
 
 </div>
 </div>
 <div class="about_right fr"></div>
 </div>
 </div>

CSS部分代码:

/*about*/
.about{width:100%;height:195px;background: #E6EAED;}
.about_main{width:1200px;height:195px;}
.about_left{width:230px;height:195px;background: #999;}
.about_center{width:740px;height:195px;background: #f29;}
.about_right{width:230px;height:195px;background:#0d3;}

解决方面如下:

修改CSS部分

.about{width:100%;height:195px;background: #E6EAED;position: relative;}
.about_main{width:1200px;height:195px;position:absolute;left:50%;top:0;margin-left:-600px;overflow: hidden;}

 

 

转载请注明:MitNick » 2个以上div横排,后面的div出现向下移位(错位)问题解决方法

喜欢 (9)or分享 (0)
头像
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址