【问题标题】:turning css class into mixin将 css 类变成 mixin
【发布时间】:2014-05-06 12:40:33
【问题描述】:

下面是我的css代码。

div {
 &:before {
    position: absolute;
    width: 48%;
    height: 10px;
    content: ' ';
    left: 20px;
    bottom: 40px;
    @include vendor(transform, top);
    @include vendor(transform, skew(-5deg) rotate(-3deg));
    @include vendor(box-shadow, 0 30px 4px 10px red);
    z-index: -1;
  }
}

下面是我的mixin。

@mixin prefix($property, $value) {
  -webkit-#{$property}: $value;
  -moz-#{$property}: $value;
  -ms-#{$property}: $value;
  -o-#{$property}: $value;
  #{$property}: $value;
}

是否可以将整个前块代码转换为通用的mixin,如add-effect

【问题讨论】:

    标签: css twitter-bootstrap mixins saas


    【解决方案1】:
    @mixin add-effect {
     &:before {
        position: absolute;
        width: 48%;
        height: 10px;
        content: ' ';
        left: 20px;
        bottom: 40px;
        @include vendor(transform, top);
        @include vendor(transform, skew(-5deg) rotate(-3deg));
        @include vendor(box-shadow, 0 30px 4px 10px red);
        z-index: -1;
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2013-02-14
      • 2021-10-01
      • 1970-01-01
      • 2020-06-13
      • 2012-03-18
      • 1970-01-01
      • 1970-01-01
      • 2014-03-30
      • 2021-07-15
      相关资源
      最近更新 更多