sass @extend

扩展单一选择器

前面我们知道 %placeholder 不使用@extend显示调用是不会生成任何样式代码。那么在选择器中使用占位符一样。比如下面的代码:

#context a%extreme {
  color: blue;
  font-weight: bold;
  font-size: 2em;
}

这段代码在不调用之前不产生任何代码,只有能过@extend调用之后才生成代码:

.notice {
  @extend %extreme;
}

编译出来的CSS

#context a.notice {
  color: blue;
  font-weight: bold;
  font-size: 2em;
}


你可能感兴趣的:(代码,sass)