我想将一个 div
float 到中心。可能吗? text-align: center
在 IE 中不工作。
最佳答案
本身没有 float 到中心。如果你想将 block 元素置于另一个元素的中心,请执行以下操作:
<div id="outer">
<div id="inner">Stuff to center</div>
</div>
与:
#outer { width: 600px; }
#inner { width: 250px; margin: 0 auto; }
现在不会让文本环绕它(就像它向左或向右浮动一样)但就像我说的:没有 float 中心。
关于html - 将 div 居中对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1740587/