12
LESS CSS Bryan Lin 2013/12/27

Less css

Embed Size (px)

Citation preview

Page 1: Less css

LESS CSSBryan Lin 2013/12/27

Page 2: Less css

Agenda• Variables

• Mixins

• Nested rules

Page 3: Less css

Variables• Declare a variable

• @Nice-blue: #5B83AD;

• @Fnord: "I am fnord.“

• Example

• Ouputs: #header { color: #6c94be; }

Page 4: Less css

Variables• When defining a variable twice, the last definition of the variable is used,

searching from the current scope upwards. This is similar to css itself where the last property inside a definition is used to determine the value.

Page 5: Less css

Variables• Lazy loaded

Page 6: Less css

Mixins• In LESS, it is possible to include a bunch of properties from one ruleset into

another ruleset

Page 7: Less css

Mixins• Result

Page 8: Less css

Nested rules• We have the following CSS

Page 9: Less css

Nested rules• In LESS, we can also write it this way

Page 10: Less css

Nested rules• Notice the & combinatory

• It’s used when you want a nested selector to be concatenated to its parent selector

Page 11: Less css

FAQ

Page 12: Less css

Reference• http://lesscss.org/