如何在scss中编写此运算符?

时间:2018-09-05 19:01:06

标签: css sass

我试图根据我在scss中输入的内容在HTML中添加字符串the color is green

@mixin jeansColor($jeancolor) {
  if(type-of($jeancolor)==string) {
    content: "the color is green"
  }
}

.jeans:after {
  @include jeansColor("green");
}
<p class="jeans"> Jeans </p>

1 个答案:

答案 0 :(得分:1)

细节总是如此……只是忘了用@CodePen :)实例化if

@mixin jeansColor($jeancolor) {
  @if(type-of($jeancolor)==string) {
    content: "the color is green"
  }
}

.jeans:after {
  @include jeansColor("green");
}
<p class="jeans"> Jeans </p>