严格的DocType在FF / Chrome中强制实施最小表行高度 [英] Strict DocType imposes minimum table row height in FF/Chrome

查看:110
本文介绍了严格的DocType在FF / Chrome中强制实施最小表行高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以前我从来没有注意到,但似乎在Chrome / Firefox(可能Opera / Safari,我没有检查具体)使用严格的doctype防止表行显示小于一个值,无法确定计算。

Something i'd never noticed before, but it seems that in Chrome/Firefox (and probably Opera/Safari, i've not checked those specifically) using a strict doctype prevents table rows from being displayed smaller than a value that i'm unable to determine the calculation of.

下面的文档显示了在IE7中可能想象的所有表行,高度为8px,以匹配内容的高度这可能是不正确的知道IE),而在Chome / Firefox的行都是23px高。没有任何组合的边框折叠,填充,边距等我发现将允许行小于这。

The following document displays as one might imagine in IE7 with all table rows around 8px in height to match the height of the content (which is probably incorrect knowing IE), whilst in Chome/Firefox the rows are all 23px tall. No combination of border-collapse, padding, margin etc i've found will allow the rows to be smaller than this.

    <!DOCTYPE html PUBLIC "-//W3C//DTD Xhtml 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <style>
    span {
      font-family: Verdana;
      font-size: 8px;
      line-height: 8px;
    }
  </style>
</head>
<body>
  <table cellspacing="1" border="1">
    <tr>
      <td><span>One</span></td>
      <td><span>Two</span></td>
      <td><span>Three</span></td>
    </tr>
    <tr>
      <td><span>Four</span></td>
      <td><span>Five</span></td>
      <td><span>Six</span></td>
    </tr>
    <tr>
      <td><span>Seven</span></td>
      <td><span>Eight</span></td>
      <td><span>Nine</span></td>
    </tr>
  </table>  
</body>
</html>

将doctype设置为transition会使表行按照预期在高度上显示为8px。

Setting the doctype to transitional causes the table rows to display around 8px in height as expected.

有没有人知道是什么导致这个明显的最小行高?

Does anyone have any idea what's causing this apparent minimum row height?

任何信息的干杯。

推荐答案

您需要在< td> < span>

td{line-height:8px;}

这篇关于严格的DocType在FF / Chrome中强制实施最小表行高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆