Skip to content
On this page

字符转义

Stylus 允许你转义字符。这实际上将它们转换为标识符,使它们可以被渲染为字面量。

例如:

stylus
body
  padding 1 \+ 2
body
  padding 1 \+ 2

编译为:

css
body {
  padding: 1 + 2;
}
body {
  padding: 1 + 2;
}

注意,Stylus 要求在属性中使用 / 时必须用括号括起来:

stylus
body
  font 14px/1.4
  font (14px/1.4)
body
  font 14px/1.4
  font (14px/1.4)

生成:

css
body {
  font: 14px/1.4;
  font: 10px;
}
body {
  font: 14px/1.4;
  font: 10px;
}

Released under the MIT License.