炫意html5
最早CSS3和HTML5移动技术网站之一

Stylus 块(@block)

本文是《CSS框架》系列文章第 20篇 (共 41 篇)

您可以将Stylus中的任何代码块赋值给变量,然后调用它,作为参数传递或以任何其他方式重用。

To define a block, either write it down with an increased indent after an assign sign:

foo =
  width: 20px
  height: 20px

or use a curly braces syntax with @block keyword:

foo = @block {
  width: 20px
  height: 20px
}

if you would like to render this block anywhere, you could call this variable inside an interpolation, so

.icon
  {foo}

would render to

.icon {
  width: 20px;
  height: 20px;
}

BTW, this is the same way you can use the blocks passed to the block mixins.

Right now you can only pass the variable as any other variable and render it inside an interpolation. In future we would provide more ways of handling it.

<< Stylus Sourcemapsstylus 连接中间件(Connect Middleware) >>

炫意HTML5 » Stylus 块(@block)

Java基础教程Android基础教程