SassScript 05 @-Rules与指令

80 阅读1分钟

1. @import

只能引入 .scss 或者 .sass 文件 。

2 . @media

与 css 中的用法一样 。

3 . @extend样式继承

3.1 选择器 :

  • 延伸复杂的选择器 :
.hoverlink {
  @extend a:hover;
}
a:hover {           // 复杂的选择器
  text-decoration: underline;
}
  • 多重延伸 :

一个可以延伸继承多个 ,一个也可以被多个延伸

  • 继续延伸 :

A 延伸继承 B ,C可以延伸继承 B

3.2 选择器列 :

不能将延伸器列如 .box .name 延伸继承给其它选择器 。

3.3 占位符选择器 :

用法如下 :

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

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