2015-11-25 36 views
0

我想知道是否有可能实现这一目标代码:萨斯嵌套延长里面是自己的父母

section#content { 
    position: absolute; 
    top: 0; 
    right: 0; 
    bottom: 0; 
    left: 0; 
    overflow: hidden; 
} 
section#content > div { 
    position: absolute; 
    top: 0; 
    right: 0; 
    bottom: 0; 
    left: 0; 
    overflow: hidden; 
    overflow-y: auto; 
    padding-left:60px; 
} 

通过这样做:

section#content { 
    position: absolute; 
    top:0; 
    right:0; 
    bottom:0; 
    left:0; 
    overflow: hidden; 
    & > div { 
     @extend section#content; 
     overflow-y: auto; 
     padding-left:60px; 
    } 
} 

,因为现在我的输出是:

section#content, section#content > div { 
     position: absolute; 
     top: 0; 
     right: 0; 
     bottom: 0; 
     left: 0; 
     overflow: hidden; 
    } 
    section#content > div, section#content > div > div { 
     position: absolute; 
     top: 0; 
     right: 0; 
     bottom: 0; 
     left: 0; 
     overflow: hidden; 
     overflow-y: auto; 
     padding-left:60px; 
    } 

正如你所看到的,每个班级还有另外一个“> div”,因为这个扩展名正在调用itseft ... 对不起,我的英语我是法国人

+0

我建议使用占位符选择符而不是扩展名。 – Peiwen

回答

0

谢谢培文。我是Compass/SASS的新手,所以对于在这里寻找解决方案的人来说我是这样的:

%full-block { 
    position: absolute; 
    top:0; 
    right:0; 
    bottom:0; 
    left:0; 
    overflow: hidden; 
} 
section#content { 
    @extend %full-block; 
    & > div { 
     @extend %full-block; 
     overflow-y: auto; 
     padding-left:60px; 
    } 
}