我有以下 HTML 片段,它创建了一个在最后一列带有滚动条的表格。我的问题是 IE 呈现的方式与 Firefox 不同。任何线索将不胜感激。
<!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>
<title>Test of tables and CSS</title>
<style type="text/css">
td
{
border:solid 1px #000000;
padding:2px 2px 2px 2px;
}
</style>
</head>
<body>
<table cellspacing="0" style="border:solid 1px #000000;border-collapse:separate;padding:0 0 0 0;">
<tr>
<td>Col 1 1</td>
<td>Col 1 2</td>
<td rowspan="5" style="width: 1px; padding: 0 0 0 0;height:100%;"><table cellspacing="0" style="border: none; height:100%;border-collapse: collapse; padding: 0 0 0 0;">
<tr><td style="border: none; height: 1px; background-color: #C9D8FC;"><img alt="" src="../img/ico/ScrollUp.gif" style="border: none;" /></td></tr>
<tr><td style="border: none; height: auto; background-color: #C9D8FC;"></td></tr>
<tr><td style="border: none; height: 1px; vertical-align: bottom; background-color:#C9D8FC;"><img alt="" src="../img/ico/ScrollDown.gif" style="border:none;" /></td></tr>
</table></td>
</tr>
<tr>
<td>Col 2 1</td>
<td>Col 2 2</td>
</tr>
<tr>
<td>Col 3 1</td>
<td>Col 3 2</td>
</tr>
<tr>
<td>Col 4 1</td>
<td>Col 4 2</td>
</tr>
<tr>
<td>Col 5 1</td>
<td>Col 5 2</td>
</tr>
</table>
</body></html>
火狐:
IE 8:
最佳答案
您可以在 header 中使用条件注释将特定样式声明发送到 Internet Explorer 吗?
<!--[if IE]>
Only IE will output what's between these brackets, style declarations etc.
<![endif]-->
关于html - 如何在不同浏览器的 html 中用背景颜色填充 html 表格单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4146236/