IE7使文本比它应该更长

时间:2013-06-27 19:48:36

标签: html internet-explorer html-table

首先,代码:

<tr>
  <td width="610" 
     style="font-family:Verdana, 
            Geneva, sans-serif;
            text-decoration:none !important; 
            font-size: 9px; 
            color: #231F20;margin:0px;  
            padding:0px; margin-right:10px;">
    <span style="font-family:Verdana, Geneva, sans-serif; 
                 text-decoration:none !important;  
                 font-size: 1em; color: #231F20; 
                 margin-right:10px;">
      CancerFactsFigures&#47;BreastCancerFactsFigures&#47;
      breast-cancer
     -facts-and-figures-2011-2012. Accessed June 6, 2012.
    </span>
  </td>
</tr>

我的问题是这段代码包含在IE7和IE8中的新行。我已经将它与其他浏览器进行了比较,我可以看出整个生产线上的堆积有额外的间距导致它最终溢出。

这是在一个宽度为600的表中设置的。是的,我知道我的TD宽度设置为610,我只是在弄乱,看看我是否可以欺骗IE。

更新的代码只有1个跨度,但问题并没有消失。

发生了什么事?我很难过。

2 个答案:

答案 0 :(得分:3)

这是由字体渲染变化引起的,特别是IE 9和旧版IE之间的差异,请参阅About Text Rendering in Windows Internet Explorer 9。您应该设计代码,使布局不依赖于渲染的细节,例如某些文本占用的确切宽度。例如,避免在表格单元格上设置固定宽度。

答案 1 :(得分:0)

您还有一个</span>