IE8忽略td宽度,在IE7上工作 [英] IE8 ignores td width, works on IE7

查看:112
本文介绍了IE8忽略td宽度,在IE7上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我一直试图让一个网站工作半天不起。 IE8对我的精神状态不利。

I've been trying to make a site work for half a day to no avail. IE8 is bad for my mental state.

因此,有一个表格如下:

So, there is a table looking like this:

<table width="100%">
<tr id="header">
 <td colspan="2"></td>
</tr>
<tr id="center">
 <td id="left" style="width: 201px"></td>
 <td id="mainpage" style="width: 100%"></td>
</tr>
</table>

在每个浏览器(包括IE7)中,除了IE8外,lefttd都很好。在IE8它超过了根据主页的内容的宽度。

In every browser (including IE7) apart from IE8 the "left" td is fine. In IE8 it exceeds the width according to the mainpage's content.

我会发布一些截图,但它是我的第一篇文章。

I'd post some screenshots but it's my first post here.

任何想法?

推荐答案

width:100%在第二列看起来不正确 - 如果你想让第二列扩展到剩余的可用空间,你不应该需要,所以你可以删除它。
此外,将它添加到您的表中:

That width: 100% on the second column doesn't look right - if you're trying to make the second column expand to the rest of the available space, you shouldn't need that at all, so you can remove it. Also, add this to your table:

table-layout: fixed;

以确保符合宽度。

完整代码:

<table style="width: 100%; table-layout: fixed;">
<colgroup>
    <col style="width: 201px">
</colgroup>
<tr id="header">
    <td colspan="2"></td>
</tr>
<tr id="center">
    <td id="left"></td>
    <td id="mainpage"></td>
</tr>
</table>

这篇关于IE8忽略td宽度,在IE7上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆