⊗mkLsBsMWC 27 of 41 menu

Comma Separated Concatenation in LESS

Let's say we have a function that creates a box shadow:

.shadow(@s) { box-shadow: @s; }

Let's say we want to add two shadows to a block by calling our function twice:

p { .shadow(1px 1px red); .shadow(2px 2px blue); }

However, this won't work for us, because calling two shadows will simply add two box-shadow properties:

p { box-shadow: 1px 1px red; box-shadow: 2px 2px blue; }

And we would like the shadows to be added to one property box-shadow separated by commas, like this:

p { box-shadow: 1px 1px red, 2px 2px blue; }

In order for our function to work as described, we need to write the property value after the special operator +:, like this:

.shadow(@s) { box-shadow+: @s; }

Make a similar function for the text-shadow property.

Make a similar function for the background property.

enru