以下图像是使用同一浏览器(Chrome 25)对同一页进行的渲染。唯一的区别是一个页面具有一个DOCTYPE(因此在执行标准模式)和一个没有(因此怪癖)铬在怪癖和标准模式下垂直对齐
怪癖:
标准:
两种细胞具有vertical-align: middle
,两张图片都是display: inline-block
。
垂直对齐工作怪癖,但不是在标准,为什么?
HTML
<table class="oppres" id="oppscore4">
<tbody>
<tr id="oppscore4-main">
<td><img src="images/gold.png"></td>
<td></td>
<td>0</td>
</tr>
<tr></tr>
<tr id="oppscore4-total">
<td></td>
<td>=</td>
<td>0</td>
</tr>
</tbody>
</table>
CSS
table.oppres{
height: 120px;
}
table[id^=oppscore]{
width: 80px;
font-size: 17px;
line-height: 1;
}
table[id^=oppscore] tr{height: 1em;}
table[id^=oppscore] img{height: 0.9em;}
table[id^=oppscore] tr:nth-last-child(2){height: auto;}
table[id^=oppscore] td:first-child{text-align: right;}
足够多的代码来重现问题更多。
请张贴您的代码 – 2013-02-27 06:10:53
与标准相比,怪癖中的图片看起来有点像裁剪。标准正确地表明了它的可能性,而且怪癖不是(怪癖的本质)。没有代码就很难推测这个问题。 – fredsbend 2013-02-27 08:04:31
添加了一些代码 – TwiNight 2013-02-27 08:58:17