Programmability
Stylus provides a relatively minimal but efficient programming language in addition to the CSS syntax. Using this programming language, you can make CSS generation dynamic and more flexible.
Note
The Stylus programming language is limited in many ways, and some implementation may still be buggy due its young age.
Variables
Although the data type is not strongly defined in Stylus, variables can be broadly classified as literals, lists, and tuples.
Stylus variable identifiers can start with any alphabetical character: $
, -
, or _
and contain alphanumeric characters along with the aforementioned characters.
The following are some examples of variables in Stylus:
$font-weight = bold num = 100 vendors = moz webkit ms -height = (num/5)px _width = 200
Literals
The most common data type in Stylus is literals. Literals are strings of text that are not lists or tuples, and are interpreted literally.
The following table demonstrates how literal variables can be used in CSS declarations:
Stylus... |
---|