-2
在这里,你可以展示我的代码示例:Jsfiddle垂直文本中心
<div id="gameTimeBar-holder">
<div id="gameTimeBar"></div>
<div class="progressBarText">Actions : 852 minutes</div>
#gameTimeBar-holder{width:200px;height:15px;background:grey; position:absolute; top:45px; left:5px;}
#gameTimeBar{width:0;height:100%;background:purple;}
.progressBarText{position:absolute;z-index:10;top:0;left:0;width:100%;text-align:left; color: white;}
我怎么能垂直中心我的文字在div progressBarText?
噢,是的,这很简单..谢谢! –
很高兴帮助你:) @ClémentAndraud –
这只是滥用'line-height'。如果他有多行文字会怎么样。 – crush