Sass字符串函数-quote($string)

2020-02-20  本文已影响0人  混吃等死小前端

如果字符串,自身带有引号会统一换成双引号 ""

//.scss
.test1 {
    content:  quote('Hello Sass!');
}
.test2 {
    content: quote("Hello Sass!");
}
.test3 {
    content: quote(ImWebDesigner);
}
.test4 {
    content: quote(' ');
}
//.css
.test1 {
  content: "Hello Sass!";
}
.test2 {
  content: "Hello Sass!";
}
.test3 {
  content: "ImWebDesigner";
}
.test4 {
  content: "";
}

字符串中间有单引号或者空格时,需要用单引号或双引号括起,否则编译的时候将会报错。

.test1 {
    content:  quote("Hello's Sass");
}

quote() 碰到特殊符号,比如:!?> 等,除中折号 - 和 下划线_ 都需要使用双引号括起,否则编译器在进行编译的时候同样会报错


上一篇 下一篇

猜你喜欢

热点阅读