开发者

HTML Strict increases line height

开发者 https://www.devze.com 2022-12-31 08:26 出处:网络
Why does XHTML 1.0 Strict display a line height as appearing larger than a line height of the same value in XHTML 1.0 Transitional?

Why does XHTML 1.0 Strict display a line height as appearing larger than a line height of the same value in XHTML 1.0 Transitional?

This therefore pushing down content within table cells (i.e Hotmail in Firefox, Gmail in IE and Firefox). Has anyone else experienced this issue and know a way around it?

Cheers

Heres an example code for each XHTML type:

Transitional:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="500" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td style="line-height:18px;"><font style="line-height:18px; font-size:16px; font-family:Arial, Helvetica, sans-serif;">This cell will be larger in Strict</font></td>
  </tr>
</table>

</body>
</html>

Strict:

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table width="500" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td style="line-height:18p开发者_Go百科x;"><font style="line-height:18px; font-size:16px; font-family:Arial, Helvetica, sans-serif;">This cell will be larger in Strict</font></td>
  </tr>
</table>
</body>
</html>


@ryano as far as I am aware, there is not a definitive fix for this, most people seem to be using a margin-top:-2px; fix on the table-cell itself.

Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消