SASS,调用 mixin 的正确方法是什么? [英] SASS, What is the correct way to call a mixin?

查看:63
本文介绍了SASS,调用 mixin 的正确方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用 SASS,我正在尝试弄清楚如何创建一个盒子阴影混合...

I just started using SASS and I am trying to figure out how to create a box shadow mixin...

我从另一个堆栈溢出帖子中复制了这个 mixin..

@mixin box-shadow($top, $left, $blur, $color, $inset:"") {

      -webkit-box-shadow:$top $left $blur $color #{$inset};
      -moz-box-shadow:$top $left $blur $color #{$inset};
      box-shadow:$top $left $blur $color #{$inset};
    }

但是我不确定如何格式化我的 @include

However I am not sure exactly how to format my @include

这就是我目前的@include

@include box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);

这是我的输出错误...

error(Line 1003: Invalid CSS after "...lude box-shadow": expected "}", was ": inset 0 1px 1...")

推荐答案

语法错误.

使用@include box-shadow(0, 1px, 1px, rgba(0, 0, 0, 0.075), inset);

(在 2014 年进行了编辑,包括过去几年对 Sass 语法的更改)

(Edited in 2014 to include changes to Sass' syntax made in the last few years)

这篇关于SASS,调用 mixin 的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆