<分区>
<分区>
Possible Duplicate:
Horizontally and vertically center a pre tag without the use of tables?
如何在不指定宽度的情况下水平和垂直居中文本?
现在我有:
<div class="center">
<p id="logo"><span>Coming soon!</span></p>
</div>
CSS 是:
span {
color:#ff0000;
font-size: 14px;
font-weight:normal;
font-family:sans-serif;
border-bottom-color: currentColor;
border-bottom-style: dotted;
border-bottom-width: 1px;
line-height: 1.1;
}
.center {
width:150px;
height:100px;
position:absolute;
left:50%;
top:50%;
margin-left:-100px;
margin-top:-50px;
}
因为文本的宽度会不同,所以我需要另一种解决方案。
最佳答案
关于html - 相对文本居中。垂直和水平,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8961643/