这里是什么我谈论的例子中,你需要放大看问题 http://jsfiddle.net/54NEa/如何垂直对齐文本? (垂直对齐不工作)
<div id="top">SomeText</div>
<div id="middle">SomeText</div>
<div id="bottom">SomeText</div>
div{
display: inline-block;
background-color: red;
font-family: Lucida Sans Unicode,Verdana,Arial,Helvetica,sans-serif;
font-size: 10px;
line-height: 10px;
}
div.top {vertical-align:top;}
div.middle {vertical-align:middle;}
div.bottom {vertical-align:bottom}
线路10px的,但没有按文本” t完全填充它,它具有额外的填充 - 在FF中,填充低于Chrome,并在Chrome中填充它,而不管垂直对齐属性如何。这与字体有所不同,但它从来没有完全填充它的行高,它“摇摆”。任何想法如何修正该字体相对于其行的一个位置,无论浏览器?我做了一个小css按钮,我需要确保我的行高度正好是10px,文本的高度也正好是10px,所以它看起来总是一样的。
看看这个http://phrogz.net/css/vertical-align/index.html – Pevara