相关疑难解决方法(0)

Sass使用伪选择器扩展

我正在使用罗盘来管理mac osx上的一些sass文件.我有这些文件:

sass/
      screen.scss
            partials folder/
      ...
            _fonts.scss
            _functions.scss
      ...
Run Code Online (Sandbox Code Playgroud)

在字体中,我有这个规则,我想重用@extend.

//fonts.scss
.icon-ab-logo, {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
.icon-ab-logo:before { //i want to reuse this.
content: "\e000";
}
Run Code Online (Sandbox Code Playgroud)

在函数我有这个screen.scss:

.logo {
position: absolute;
top: 0;
bottom: 0px;
z-index: 500;
width: 9.5em;
background: $logo;
@include transition(all 0.2s);
   &:after{
     @include icon( ".icon-ab-logo" );
   }
 }
Run Code Online (Sandbox Code Playgroud)

最后在functions.scss中我称之为:

    @mixin icon( $icon ){
      font-family: 'icomoon';
      speak: none;
      font-style: normal;
      font-weight: normal;
      font-variant: …
Run Code Online (Sandbox Code Playgroud)

function sass extend mixins

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

extend ×1

function ×1

mixins ×1

sass ×1