div不会随着表格展开而扩展,或者div在展开时不会居中 [英] div doesnt expand as table expands, or div doesnt center when it expand

查看:199
本文介绍了div不会随着表格展开而扩展,或者div在展开时不会居中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很奇怪。

它可以在IE中使用,但不能在FF中使用。

It works in IE but not FF.

at: http://www.sumsy.com/temp/test11/test.html(表格最初为980像素)
http://www.sumsy.com /temp/test11/test2.html (表格展开为1200px)

Please take a looks at: http://www.sumsy.com/temp/test11/test.html (table is 980px initially) http://www.sumsy.com/temp/test11/test2.html (table expanded to 1200px)

问题是,在展开表之后,最外层的div(#body-左)在FF中不再居中。

The problem is, after table is expanded, the outer most div (#body-left) is not centered any more in FF. The space on the left remains the same.

我用firebug检查,看起来像#body-left div的宽度固定在999px,所以它没有展开当表

I checked with firebug, it looks like the #body-left div width is fixed at 999px, so it didnt expand when table expands.

我可以通过从#body-left div中删除999px宽度来修复它。

I can some how fix it by removing the 999px width from #body-left div. But if i do that, the div wont center any more.

我需要它居中,所以我必须为它指定一个宽度吗?

I need it to be centered, so I have to specified a width for it?

任何工作?

谢谢。

推荐答案


  • #body-left 中删除​​ width 添加 display:inline-block

  • c $ c> text-align:center

  • #body-left c $ c> text-align:left 。

    • Remove the width property from #body-left, and add display: inline-block.
    • On body, add text-align: center.
    • On #body-left, add text-align: left.
    • 现场演示

      IE7,添加到#body-left * display:inline; zoom:1

      这篇关于div不会随着表格展开而扩展,或者div在展开时不会居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆