2013-08-02 87 views
1

好了,所以這就是我想要達到的目標:用薩斯薩斯嵌套多個類

.about{ 
    /* some styling */ 
} 
.about,.about-pg{ 
    /* other styling */ 
} 

,我想我可以做

.about 
    /* some styling */ 
    &,.about-pg 
    /* other styling */ 

但是它編譯於:

.about{ 
    /* some styling */ 
} 
.about,.about .about-pg{ 
    /* other styling */ 
} 

任何線索爲什麼以及如何解決這個問題?

+0

使用一個變量可能? – FelipeAls

+0

@FelipeAls那會怎麼樣呢?主要問題在於Sass引入了另一個 - 在這種情況下 - '.about',我不想要它。 – japborst

+1

[SASS只適用於一種風格]的可能重複(http://stackoverflow.com/questions/12382656/sass-apply-to-only-one-style) – cimmanon

回答

0

使用@extend

.about 
    /* some styling */ 
    @extend .about-pg 

.about-pg 
    /* other styling */