html - 在 Sass 文件中创建 Mixin
问题描述
这是我的代码,我想在我的 sass 文件中创建 mixins
=shaping($height , $width, $rad, $bg, $color)
height: $height
width: $width
-webkit-border-radius: $rad
-moz-border-radius: $rad
-ms-border-radius: $rad
background-color: $bg
border-radius: $rad
color: $color
但是编译的时候出现这个错误,不知道是什么问题,谁能帮帮我?是因为语法吗?
error: properties are only allowed within rules, directives, mixin includes or other properties
解决方案
=shaping($height, $width, $rad, $bg, $color)
height: $height
width: $width
-webkit-border-radius: $rad
-moz-border-radius: $rad
-ms-border-radius: $rad
border-radius: $rad
background-color: $bg
color: $color
.element
+shaping(50px, 50px, 10px, #000, #fff)
在选择器之后,换行。例如
.element
+shaping
推荐阅读
- c# - C#数据表循环并查找某些列不为空
- angular - 从角度 7 中的 html 中删除外部组件标记
- python - 使用列值python对excel文件进行排序
- rust - 产生每个部分结果的折叠算法
- flutter - 如何根据从 0 开始的给定行号删除 dart 中的特定行
- java - 在 Java 中计算二项式系数的最快方法
- azure - azure 用户 ID 是否已更改其格式?
- typescript - 打字稿中的联合类型推断
- python - 又一个 ImportError:尝试使用没有已知父包的相对导入
- python - 居中 python curses.panel 子菜单