我需要显示一个第一行带下划线的表格。
为此,我设置了 border-collapse 并仅为第一行设置了边框。
它在 IE 7 和 FF 中运行良好。但在 IE 8(兼容模式)下,底部边框被打破。
查看此 fiddle
<table style = "border-collapse:collapse;" width="90%"
cellpadding="1" cellspacing="1">
<tbody>
<tr>
<th align="left" style="border-top:0px; border-left:0px; border-right:0px;
border-bottom:1px solid #838584;">Text1</th>
<th align="right" style="border-top:0px; border-left:0px; border-right:0px;
border-bottom:1px solid #838584;">Text2</th>
<th align="right" style="border-top:0px; border-left:0px; border-right:0px;
border-bottom:1px solid #838584;">Text3</th>
</tr>
</tbody>
</table>
注意:我尝试在我的 HTML 中给出 !DOCTYPE,如下所示。但是,当时页面本身并没有在 IE 8(兼容模式)中呈现。它仍然在 IE7 和 FF 中按预期工作
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
此外,在 IE 8 标准模式下一切正常
最佳答案
我在 Firefox 9、IE7 和 IE8(只测试了这些浏览器)中看不到表格之间的任何区别。您是否在标准模式下使用 IE8?边框仅在 IE8 标准模式下是实心的。在 IE8 上以 IE7 标准或怪癖模式运行将打破单元格结束/开始的边界。
您可能想查看 this post关于如何强制 IE8 在标准模式下运行或在 IE8 中按 F12 以在 IE 开发人员工具中检查您当前的模式
关于html - IE 8 兼容模式下的边框折叠问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9240772/