【问题标题】:How to get button text to align top in IE?如何让按钮文本在 IE 中对齐顶部?
【发布时间】:2012-05-25 22:48:53
【问题描述】:

我在按钮中有一些文本。我希望此文本在按钮顶部对齐。默认情况下,它似乎与中间对齐。在 webkit 中,我可以使用 -webkit-box-align: start;这似乎不适用于 IE。

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

【问题讨论】:

  • 请问哪个版本的 IE? IE6 != IE9 ;) Lesser IE:我从填充和行高开始
  • 它是否必须恰好是 n 像素高?还是只是为了举例?

标签: css internet-explorer alignment


【解决方案1】:

您可以尝试关注 (example):

html:

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

css:

button {
     height: 100px;
}

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

}

【讨论】:

  • 我就是这么想的,效果很好:)(在 IE 6、7、8 和 9 中!),太棒了!
  • 这就是我目前正在做的事情。不敢相信没有属性可以覆盖这种行为!
猜你喜欢
  • 2012-01-03
  • 1970-01-01
  • 2013-04-21
  • 1970-01-01
  • 2019-08-07
  • 1970-01-01
  • 1970-01-01
  • 2020-10-04
  • 1970-01-01
相关资源
最近更新 更多