【发布时间】:2014-04-05 00:55:35
【问题描述】:
制作一个简单的代码,我有一个可以垂直对齐文本栏的解决方案,如下所示:
tickstream {
display:block;
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
box-sizing:border-box;
background-color:rgb(64,224,208);
font-size:61.8vh;
font-family:"Gill Sans"
}
tickstream span {
position:absolute;
width:auto;
height:auto;
top:50%;
-webkit-transform:translate(0,-50%);
white-space:nowrap;
text-overflow:clip;
}
在这里查看小提琴:http://jsfiddle.net/S6LwG/
如何在不使用-webkit-translate:transform 的情况下做到这一点?
对于简单的垂直文本对齐来说,这似乎过于冗长。我曾经能够在不使用 transform 或 Chuck Norris 的情况下垂直对齐单行文本,现在我想不通了。
(注意:这只需要在当前的 Chrome 中工作)。
【问题讨论】:
-
一定要使用绝对定位吗?