Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.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
Internet explorer IE8在CSS3上阻塞--避免它不读取文件的其余部分_Internet Explorer_Css - Fatal编程技术网

Internet explorer IE8在CSS3上阻塞--避免它不读取文件的其余部分

Internet explorer IE8在CSS3上阻塞--避免它不读取文件的其余部分,internet-explorer,css,Internet Explorer,Css,我有以下css: .mcRow input.mcCheckbox { display:none; } .mcRow input.mcCheckbox + label { background: url('/media/img/pt/dhtml/mc_off.gif') no-repeat; height: 19px; width: 19px; display:inline-block; padding: 0px; padding-left

我有以下css:

.mcRow input.mcCheckbox {
    display:none;
}

.mcRow input.mcCheckbox + label {
    background: url('/media/img/pt/dhtml/mc_off.gif') no-repeat;
    height: 19px;
    width: 19px;
    display:inline-block;
    padding: 0px;
    padding-left: 20px;
    width: auto;
}

.mcRow input.mcCheckbox:checked + label {
    background: url('/media/img/pt/dhtml/mc_on.gif') no-repeat;
}​

.mcRow input.mcCheckbox.checked + label {
    background: url('/media/img/pt/dhtml/mc_on.gif') no-repeat;
}​
由于IE8不能很好地与CSS3配合使用,所以我添加了一个backup.checked类,该类与jQuery切换。我希望即使JS被破坏也能显示我的自定义复选框,因此我希望在CSS3中包含:checked伪选择器

上述顺序在IE8中不起作用。似乎它忽略了:checked语句之后的所有内容

.mcRow input.mcCheckbox + label {
        background: url('/media/img/pt/dhtml/mc_off.gif') no-repeat;
        height: 19px;
        width: 19px;
        display:inline-block;
        padding: 0px;
        padding-left: 20px;
        width: auto;
    }

    .mcRow input.mcCheckbox.checked + label {
        background: url('/media/img/pt/dhtml/mc_on.gif') no-repeat;
    }
​
    .mcRow input.mcCheckbox:checked + label {
        background: url('/media/img/pt/dhtml/mc_on.gif') no-repeat;
    }​

很好用。我害怕将此添加到文件中,也害怕有人在该语句之后添加其他CSS,不知道IE8中不会读取任何CSS(我该怎么办?

当然,您可以在CSS中添加注释


但是,更好的方法可能是简单地使用IE条件注释,不在IE<9中包含该代码。

从技术上讲,如果规则不理解其选择器,它将忽略该规则。它不应该完全忽略文件的其余部分,除非文件的其余部分只有IE8不理解的CSS3选择器。如果仍然发生这种情况,那么您的CSS可能存在某种编码问题。它显然忽略了文件的其余部分。我可以在下面移动任何CSS:选中,在IE8中不读取任何内容。什么“编码”会这样做吗?@bobber205-这不是我所经历的行为,也不是我在google上能找到的任何其他人的行为。它忽略了整个语句,但在那之后它应该继续处理。除非css的结构中有错误(缺少括号或类似)。如果你去掉+标签,以后还会忽略所有内容吗?另一件事是通过W3的css验证程序运行css,看看是否有任何非法css。上面的链接似乎是针对hmtl注释的。我需要一个css解决方案。@bobber205-没有css解决方案。你必须将css拆分为不同的文件,即适用于IE和其他所有人。然后,在IE上运行时,除了正常的css之外,您还可以在html中使用条件注释来加载IE css。@bobber205-注意:我并不是说我同意您的假设,即IE8忽略了文件的其余部分,以我的经验,它不会。然而,我的观点是,如果这样的情况如果这个假设是真的,那么您可以使用条件注释来解决它。