我对@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
一个类?