【发布时间】:2015-09-27 20:47:25
【问题描述】:
如下所示,Gecko 和 Blink 对不同的 inline-block 元素执行不一致的高度计算,即使它们都具有相同的 css 类。似乎 (*pause*) Trident 是唯一能做到这一点的布局引擎。
我是否忘记(重新)设置属性?
此外,正如您在此 fiddle 中所见,如果我将填充从 .3em 更改为 1em,则 Blink 将按预期呈现。所有元素都具有相同的高度。 Gecko 仍然“坏掉”了。
有谁知道为什么会发生这种情况以及如何解决它?
<a> <button> <input> <span>
壁虎(Firefox v. 39.0)
闪烁(Google Chrome v. 43.0.2357.132 m):
三叉戟(Internet Explorer v. 11.0.9600.17843):
body {
font: normal 15px arial;
padding: 1em;
}
.button {
background: #444444;
border: none;
box-sizing: content-box;
color: #ffffff;
cursor: pointer;
display: inline-block;
font-family: arial;
font-size: 1em;
height: auto;
line-height: normal;
margin: 0;
min-height: 1em;
padding: .3em;
text-decoration: none;
}
<a class="button" href="#">button</a><button class="button">button</button><input class="button" type="button" value="button" /><span class="button">button</span>
【问题讨论】: