div不会随着表格展开而扩展,或者div在展开时不会居中 [英] div doesnt expand as table expands, or div doesnt center when it expand
问题描述
这很奇怪。
它可以在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 adddisplay: inline-block
. - On
body
, addtext-align: center
. - On
#body-left
, addtext-align: left
.
IE7,添加到#body-left
: * display:inline; zoom:1
。
这篇关于div不会随着表格展开而扩展,或者div在展开时不会居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!