如何获得按钮文本对齐顶部在IE浏览器?如何获得、按钮、文本、浏览器

2023-09-11 07:55:28 作者:蝴蝶飞不过沧海

我里面有一个按钮,一些文字。我想这个文本在按钮的顶部对齐。缺省情况下它似乎是对准到中间。 WebKit中我能得到这个文本使用-webkit-框对齐顶部对齐:启动;这似乎并没有工作的IE浏览器。

I have some text inside a button. I want this text to be aligned at the top of the button. By default it seems to be aligned to the middle. In webkit I can get this text to align top using -webkit-box-align: start; This doesn't seem to work for IE.

例: http://jsfiddle.net/RY6dQ/

推荐答案

您可以尝试以下(例如)

HTML:

<button><span>Text</span></button>​

CSS:

button {
     height: 100px;
}

button span{
    display: block;
    position: relative;
    top: -40px;

}