编译CSS为:

    1. font: 14px Arial, sans-serif;
    2. }

    变量甚至可以包含在表达式中:

    1. font-size = 14px
    2. font = font-size "Lucida Grande", Arial
    3. body
    4. font font sans-serif

    标识符 (变量名、 函数等) 也可以是$开始。例如:

    1. $font-size = 14px
    2. body {
    3. font: $font-size sans-serif;

    属性查找

    Stylus另一个很酷的、特有功能就是可以不用定义变量而引用属性。
    另一个很酷的功能独有的手写笔是而不将它们的值分配给变量定义的引用属性的能力。下面是个很好的例子,让元素水平垂直居中对齐(典型的方法是使用百分比和margin负值):

    1. position: absolute
    2. top: 50%
    3. left: 50%
    4. width: w = 150px
    5. height: h = 80px
    6. margin-left: -(w / 2)
    7. margin-top: -(h / 2)

    另外一种使用情况就是在混合中根据其他属性来定义属性值。在下面这个例子中,我们定义在z-index未被指定情况下默认值为1。

    1. position()
    2. position: arguments
    3. z-index: 20
    4. position: absolute
    5. #logo2
    6. position: absolute

    属性查找通过”冒泡”方式直到找到相应的值,或该属性不存在则返回null。在以下示例中, 被解析为blue:

    1. body
    2. color: red
    3. ul
    4. li
    5. color: blue
    6. background-color: @color