将div对齐到中心 [英] Align a div to center

查看:87
本文介绍了将div对齐到中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 div 浮动到中心是可能的。 text-align:center 在IE中不起作用...

I want to float a div to center is it possible. text-align: center is not working in IE...

推荐答案

没有浮动中心本身。如果你想把一个块元素放在另一个块中,请执行以下操作:

There is no float to center per se. If you want to center a block element inside another do this:

<div id="outer">
  <div id="inner">Stuff to center</div>
</div>

其中:

#outer { width: 600px; }
#inner { width: 250px; margin: 0 auto; }

现在不会让文本包围右),但是像我说的:没有浮动中心。

Now that won't make the text wrap around it (like it would with a float left or right) but like I said: there is no float center.

这篇关于将div对齐到中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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