我发现自己一直一起使用这些属性,这通常是像mixin这样的抽象的好机会
@mixin coverer {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
例如,全页面覆盖
<div class="overlay"></div>
.overlay {
@include coverer;
background: rgba(black, 0.5);
z-index: 1000;
}
@mixin coverer($top: 0, $left: 0, $width: 100%, $height: 100%)
position: absolute
top: $top
left: $left
width: $width
height: $height