Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在html中为不同的浏览器填充背景色的html表格单元格_Html_Css - Fatal编程技术网

如何在html中为不同的浏览器填充背景色的html表格单元格

如何在html中为不同的浏览器填充背景色的html表格单元格,html,css,Html,Css,我有下面一段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" > <hea

我有下面一段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:
高度:自动;这在IE中无法正常工作

尝试添加显示:块

这就是问题所在吗

vstyle="... should be style="... 

此外,您可能希望向表中添加一个类,而不是将样式内联,这样可以更容易阅读,但不会对呈现造成影响

您可以在标题中使用条件注释将特定样式声明发送到internet explorer

<!--[if IE]>
Only IE will output what's between these brackets, style declarations etc.
<![endif]-->

谢谢,但我在代码中找不到vstyle。。一般来说,我使用css,但我并没有在这里使用它来隔离问题:好吧,这就是为什么我找不到它。这是一个复制粘贴错误。。对不起。。仍然不起作用..对HTML表格进行大量的样式化是一个痛苦的秘诀。您是否可以在表中换行一个DIV,并指定一个显式的高度和文本溢出:auto或text overflow:滚动到该DIV?您上面粘贴的代码在firefox和firefox中给出了相同的结果ie@Ben:有什么建议吗@Sotiris,不适用于Firefox 3.6和IE 8。抱歉,伙计,我刚刚澄清了我的答案