想用CSS垂直居中div。不想要表或Javascript,但只有纯CSS。找到了一些解决方案,但都缺少对Internet Explorer 6的支持。
<body>
<div>Div to be aligned vertically</div>
</body>
如何在所有主流浏览器(包括Internet Explorer 6)中垂直居中div?
HTML:
<div class="border">
<glyph class="center" [icon]="'star'" ></glyph>
<div class="centerText">
This Is Text that is centered.
</div>
</div>
Css:
.centerText{
text-align: center;
}
.border{
我想用CSS垂直居中一个div。我不想要表格或JavaScript,只想要纯CSS。我找到了一些解决方案,但它们都缺少对Internet Explorer 6的支持。
<body>
<div>Div to be aligned vertically</div>
</body>
如何在所有主流浏览器(包括Internet Explorer6)中将div垂直居中?
我想在容器div中对文本进行居中,这样当它溢出时,它只会溢出到底部。
单行文本将居中:
------------------------
| |
|A line of text |
| |
------------------------
两行或三行文本(填充容器所需的数量)也将居中。
------------------------
|A line of text |
|A line of text |
|A line of text |
-------