1
我在SASS有一个@mixin电话歪斜。如何选择我想要传递给mixin的特定内容?
@mixin skewed {
position: relative;
&::before {
content: '';
display: block;
width: 100%;
height: 50px;
position: absolute;
transform: skewY(-2deg);
@content;
}
&::after {
content: '';
display: block;
width: 100%;
height: 50px;
position: absolute;
transform: skewY(-2deg);
@content;
}
}
从上面,你可以看到,有已经@content内 “之前” 和 “之后”。 以下是“页脚”类,如何将内容传递给“之前”而不是“之后”。
footer {
padding: 2em 0 0;
height: 100px;
background-color: $color-shade;
margin-top: 3.5em;
@include skewed {
background-color: red;
top: -25px;
}
}
你就不能排除'&:: after''@ content'? –
是否有可能在mixin中打开其他类的两个属性来扩展? – nullmicgo
页脚{&:: after {display:none}} –