Stylus Keyword Arguments

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

Stylus supports keyword arguments, or “kwargs”. These allow you to reference arguments by their associated parameter name.

The examples shown below are functionally equivalent. However, we can place keyword arguments anywhere within the list. The remaining arguments that are not keyed will be applied to the parameters that have not been satisfied.

  body {
    color: rgba(255, 200, 100, 0.5);
    color: rgba(red: 255, green: 200, blue: 100, alpha: 0.5);
    color: rgba(alpha: 0.5, blue: 100, red: 255, 200);
    color: rgba(alpha: 0.5, blue: 100, 255, 200);
  }

Yielding:

   body {
     color: rgba(255,200,100,0.5);
     color: rgba(255,200,100,0.5);
     color: rgba(255,200,100,0.5);
     color: rgba(255,200,100,0.5);
   }

To see what parameters a function or mixin accept, use the p() function:

p(rgba)

Yielding:

inspect: rgba(red, green, blue, alpha)
<< Stylus TextMate BundleStylus Expressive, dynamic, robust CSS >>
以上是Stylus Keyword Arguments的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>