html - 在 IE7 中的表格中显示背景的一个像素

标签 html css internet-explorer-7

我已经为此苦苦挣扎了一段时间,不明白为什么我在 IE7 中看到一个像素的背景(其他浏览器工作正常)。

这是一个简单的例子,在IE7中试试:

jsfiddle 链接:http://jsfiddle.net/PstEk/

<html>
<head>

<style>
.test {
    border-width: 0px;
    border-spacing: 0px;
    border-style: outset;
    border-color: red;
    border-collapse: collapse;
    background-color: blue;
}

.test th{
    border-width: 0px;
    padding: 0px;
    border-style: none;
    border-color: red;
    background-color: #fff5ee;
}

.test td {
    border-width: 0px;
    padding: 0px;
    border-style: none;
    border-color: red;
    background-color: #e1edf3;
}
</style>

<body>


<table class="test">
        <tr>
            <th>Test test</th>
            <th>Test test</th>
            <th>Test test</th>
            <th>Test test</th>
        <tr>
        <tr>
            <td>Test test</td>
            <td>Test test</td>
            <td>Test test</td>
            <td >Test test </td>
        <tr>

        <tr>
            <td>Test test</td>
            <td>Test test</td>
            <td>Test test</td>
            <td>Test test</td>
        <tr>
</table>

</body>
</html>

最佳答案

IE7 被空的 <tr> 搞糊涂了表中的元素。你是说 </tr>而不是 <tr> , 但你现在知道它的方式会导致 <tr>没有内容的元素要插入到表中。 IE7 显然给出空 <tr>元素高度为 1 像素。

关于html - 在 IE7 中的表格中显示背景的一个像素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9435770/

相关文章:

html - 如何从 <li> 中删除空格

google-chrome - 在 Chrome 中使用 CSS3 动画选择列表/下拉悬停跳跃

css-float - 显示 : inline-block and 100% height to achieve 'floating'

asp.net - asp :button disappears in IE7, 但留在 IE8 中。为什么?

javascript - IndexedDb 有纯 javascript 实现吗?

php - 如何在 html/css/js/php 中更改事件菜单项样式

javascript - 如何让 3 个 div 在容器内水平对齐,高度为 100%

html - Firefox 图像位置(覆盖)

css - float 元素在 IE7 中脱离容器,有时在 WebKit 浏览器中也是如此

css - 无论悬停不工作 IE6 和 IE7