I was looking at bootsrap mixins.less and noticed a tilde in front of box-shadow value. What purpose does it serve? If my website supports IE9 and higher should I be using it?
.box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}");
I was looking at bootsrap mixins.less and noticed a tilde in front of box-shadow value. What purpose does it serve? If my website supports IE9 and higher should I be using it?
.box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}");
That is the tilde-quote CSS escaping.
In this particular instance, it's used in order to escape the comma
,
character at the string which belongs to the multiple values ofbox-shadow
property.Because the comma is used to separate the arguments of less mixins. So they did:
Alternatively, they could pass a list of values into the
.box-shadow()
mixin.From the doc:
Hence, they could just use a semicolon at the end of the value to make the compiler treat that as a list:
Which is as the same as:
Here is an example of the above approaches.