CSS使用浮点数在IE中不需要填充

时间:2011-01-05 18:55:42

标签: html css layout css-float

这是漫长的设计日,我今天遇到了一个问题。网站www.dcninc.com/newtest/security_testing.php是我正在进行的一项新设计。

如果你在Firefox中查看它,你会注意到2个右侧框没有填充(我故意这样做是为了解决我的问题)但是如果你在IE中查看同一个页面,它会在右侧添加填充。这是我的CSS和HTML。

2 个答案:

答案 0 :(得分:2)

您有彼此嵌套的元素,宽度为250.

像这样,

<table width="250"><tr width="250"></tr><table width="250"></table></table>

由于填充使用了一些宽度,因此没有250像素的可用空间可以放入表中。我会尝试将内部元素的宽度降低10-20像素。

希望这会有所帮助。这是我引用的标记,

<table border="0" cellpadding="0" cellspacing="0" width="250">
<tr>
<td width="250" height="9" style="background:url(Images/right_box_gray_top.png) no-repeat;"></td>
</tr>
<tr>
<td style="background:url(Images/right_box_gray_middle.png) repeat-y" width="250">
<div class="list-right-info">
<table border="0" cellpadding="0" cellspacing="0" width="250">
<tr>
<td width="40"><img src="Images/icons/phonepic.jpg" border="0" /></td>
<td><center>CALL US TODAY<br /> 800.xxx.xxxx</center></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td style="background:url(Images/right_box_gray_bottom.png) no-repeat" width="250" height="108"></td>
</tr>
</table>

答案 1 :(得分:0)

尝试将此添加到标题

<!--[if lt IE 8]>
    <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
<![endif]-->