css - Sass 中的 IE 条件

标签 css class nested

问题

我使用 Paul Irish 的 IE 条件注释技巧来针对不同版本的 IE。在 sass 中,当嵌套在另一个类中时,如何应用这些类之一。

.container{
    // I need to put a ie8 specific style here which is a .ie8 class applied to the body
}

如果可能的话,我想避免这样做(能够将属性保持在一起很好):

.container{}
.ie8{
    .container{}
}

这可能吗?

最佳答案

我相信这就是您正在寻找的 - 使用 SASS's parent selector "&" ,你可以这样做:

.container {
    .ie8 & {
        // ie8 specific styles here
    }
}

关于css - Sass 中的 IE 条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23093810/

相关文章:

jquery - 为什么我的导航栏 ol 比 li 更宽?

class - 有没有一种方法可以仅使用 Konva.Rect 类属性在 Konva.Rect 类中定义文本?

html - 嵌套标签的正则表达式(最里面使其更容易)

mysql - 在嵌套集树中移动节点

c++ - 错误 LNK2019 : unresolved external symbol "public: __thiscall Signal

c# - Elasticsearch嵌套数组的多个过滤条件

javascript - CSS 和 javascript

html - 在台式计算机上尝试匹配引导卡高度

css - 媒体查询在 Internet Explorer 11 中不起作用

c++ - 是否可以在 .cpp 文件而不是其头文件中定义类的静态成员函数?