使用CSS在窗口中居中图层 [英] Centering a layer in the window with CSS
问题描述
是否有某种方法可以定位图层(div),以便它在窗口中居中
。所以,即使你调整窗口大小,它仍然会以
为中心?我想用CSS做这个就像你可以用
表。
谢谢,
~peter >
是否有某种方法可以定位图层(div)以便
在窗口中居中。所以,即使你调整窗口大小,它仍然保持中心位置?我想用CSS就像你用
表一样。
首先,图层不是div。 (曾经有一个图层元素,所以不要把它们混合在一起)。
居中的div应该是这样的:
< div style =" margin-left:auto; margin-right:auto;"> [...]< / div>
Chris
Chris Leipold写道:
是否有某种方法使图层(div)定位,使其在窗口中居中。所以,即使你调整窗口大小,它仍然居中?我想用CSS就像用桌子一样做这个。
首先,图层不是div。 (曾经有一个
图层元素,所以不要混淆它们。)
居中的div应该是这样的:
< div
style =" margin-left:auto; margin-right:auto;"> [...]< / div>
那不是''在IE5 for Windows中工作。
http://locusmeus.com /html-css/centeringpage.html
-
Els
http://locusmeus.com/
Sonhos vem。 Sonhos v?o。 Orestoébritfeito。
- Renato Russo -
那不是''在IE5 for Windows中工作。
http://locusmeus.com /html-css/centeringpage.html
omg。踢IE5 for windows。使用条件评论将IE5用户踢到
www.getfirefox.com
is there some way to make the positioning of a layer (div) so that it
is centered in the window. so even when you resize the window it stays
centered? i would like to do this with CSS just like you can with
tables.
thanks,
~peter
Hi,
is there some way to make the positioning of a layer (div) so that it
is centered in the window. so even when you resize the window it stays
centered? i would like to do this with CSS just like you can with
tables.
First, a layer is not a div. (There once was a layer-element, so don''t
mix them up).
Centering a div should work like this:
<div style="margin-left:auto;margin-right:auto;">[...]</div>
Chris
Chris Leipold wrote:
Hi,is there some way to make the positioning of a layer (div)
so that it is centered in the window. so even when you
resize the window it stays centered? i would like to do
this with CSS just like you can with tables.
First, a layer is not a div. (There once was a
layer-element, so don''t mix them up).
Centering a div should work like this:
<div
style="margin-left:auto;margin-right:auto;">[...]</div>
That doesn''t work in IE5 for Windows.
http://locusmeus.com/html-css/centeringpage.html
--
Els
http://locusmeus.com/
Sonhos vem. Sonhos v?o. O resto é imperfeito.
- Renato Russo -
Hi,
That doesn''t work in IE5 for Windows.
http://locusmeus.com/html-css/centeringpage.html
omg. Kick IE5 for windows. Use Conditional Comments to kick IE5-users to
www.getfirefox.com
这篇关于使用CSS在窗口中居中图层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!