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

标签 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: 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 配合使用,因此我包含了一个备用的 .checked 类,它使用 jQuery 进行切换。我希望我的自定义复选框即使 JS 损坏也能显示,因此我想保留 :checked 伪选择器包含在 CSS3 中。

上面的命令在 IE 8 中不能很好地运行。它似乎忽略了 :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 中添加注释。

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

关于internet-explorer - CSS3 上的 IE8 阻塞——避免它不读取文件的其余部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12961541/

相关文章:

javascript - Internet Explorer CSS 显示 block 问题

javascript - Internet Explorer 对象不支持此属性或方法

powershell 中的 html 对象错误

html - 导航栏在 Twitter bootstrap 3 中的绝对定位

html - 两个不同大小的DIV背景

html - 响应式图像组

javascript - 使用 C# 在 IE BHO 中使用类前缀名称获取元素?

jquery - 重置窗口调整大小时函数设置的高度

javascript - 进行自定义布局的更好方法

internet-explorer - Internet Explorer 悬停行为不起作用