小编ast*_*-7g的帖子

SASS/SCSS @extend规则选择器

我对@extend规则有一点问题,这就是我得到的(专注于h1):

.content-header {
    // CSS properties
    h1 {
        // CSS properties
    }
}

.box-header {
    // CSS properties
    h1 {
        @extend .content-header h1; // My selector problem!
        // And his own CSS properties
    }
}
Run Code Online (Sandbox Code Playgroud)

所以它将是:

.content-header h1, .box-header h1 {
    /* Happily sharing the same CSS properties */
}
Run Code Online (Sandbox Code Playgroud)

但似乎@extend不喜欢这样,是否有任何其他方式来写这个而不给出h1一个类?

css sass

16
推荐指数
2
解决办法
9446
查看次数

标签 统计

css ×1

sass ×1