div容器中内嵌2个 div,如何让容器div在页面中居中

left和right div必须在layout中居中显示,同时layout必须在页面中居中显示。样式该如何写?

 

------------------------------------------ 以下写法不对。(浏览器为IE7) -----------------------------------------

回答一: #layout{margin-left:auto;margin-right:auto;width:76%;} 或者 #layout{margin:auto;}

 

回答二: #layout{margin:auto;width:408px; } #left { width:200px; height:300px; float:left; } #right { width:200px; height:300px; float:right; }

 

回答三: margin-right:auto; margin-left:auto; 父容器text- align:center;

 

回答四:把三个DIV的position都设成absolute,绝对样式下设置三个层的left和top属性,慢慢调吧.肯定灵.

 

回答五: #layout { margin:0px auto; width:408px; padding-top: 25px; padding-bottom: 25px; /×text-align:center;*/ } 不要给layout设置高度就OK了!~~ IE6.0 IE7.0都是好的!~~ 补充提问一下:这种方法FF不支持,但是网上有种方法说可以解决,就是加一个空层,清除浮动,但是我试了在 FF下也是行不通的,

 

回答五:呵,在我的不懈努力下,FF下自适应高度问题被我解决了在layout中加入 height:auto!important; height:200px; min-height:200px; 就 OK了!~~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值