div容器中内嵌2个 div,如何让容器div在页面中居中
2010-05-05 11:14
267 查看
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了!~~
------------------------------------------ 以下写法不对。(浏览器为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了!~~
相关文章推荐
- 如何用DIV+CSS来构建内嵌页面跟随按钮变化
- 9、如何控制框架页面或<iframe>内嵌页面在指定页面(区域)打开页面? [除了div+css,框架页面也不能忘记]
- 如何让div页面居中|让div在页面居中的方法
- 如何设置图片、文字在容器(div)中垂直居中的显示?
- 如何用DIV+CSS来构建内嵌页面跟随按钮变化
- 如何设置图片、文字在容器(div)中垂直居中的显示?
- 如何让div在整个页面中居中?
- 如何让div容器水平居中显示在父容器中
- 如何根据iframe内嵌页面调整iframe高宽
- 如何传值在2个页面之间 要求不刷新父页面,并且不能用Querystring传值
- 如何使 一个 div 居中显示
- 一个div层在页面上下左右居中以及数据的排序
- 如何css控制div始终在整个页面最底部
- 让2个DIV居中并排显示
- 如何让整个页面内容居中?
- 前端学习-如何让一个表格在DIV内居中显示
- 如何让DIV在body中居中
- 如何修正DIV float之后导致的外部容器不能撑开的问题
- div页面垂直居中方法方法
- 如何控制页面居中