2013-08-02 86 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 */