我有一些非常简单的HTML和CSS不会在Internet Explorer 6。

工作
<!DOCTYPE HTML>
<html>
    <head>
        <style>        
            table td.one.read {background-color:#FFD700;}
            table td.two.read {background-color:#0000ff;}
            table td.three.read {background-color:#ff8c00;}
        </style>
    </head>

    <body>
        <table>
            <tr class="head">
                <td></td>
                <td class='one read'>one</td>
                <td class='two read'>two</td>
                <td class='three read'>three</td>
            </tr>

            <tr>
                <td>Legend</td>
                <td class='one read'>1</td>
                <td class='two read'>2</td>
                <td class='three read'>3</td>
            </tr>
        </table>
    </body>
</html>

一个简单的表,其具有用于每列不同的背景色。我已经删除了一堆其他的CSS / HTML的让事情变得简单。问题是所有列显示为相同的橙色在Internet Explorer 6,在火狐

我怎样才能使它工作?

有帮助吗?

解决方案

这是在IE6中的错误。

如果您有多个类名称(例如,.three.read)一个CSS选择器,IE6会忽略所有的类名称的除了最后一个。

因此,IE6可以看到三个CSS规则用于选择器table td.read

要解决这个问题,你可以结合你的类。 (例如,<td class='OneRead'>table td.OneRead {background-color:#FFD700;}

其他提示

多类不是在IE6的支持,要等上几年IE6死之前。不过现在,你可以为颜色创建单独的类。

scroll top