Question

I needed to be able to get a less variable into

/* Opacity */
.opacity(@opacity: 0.35){
    -moz-opacity: @opacity;
    -khtml-opacity: @opacity;
    -webkit-opacity: @opacity;
    opacity: @opacity;
    @ieOpacity: @opacity * 100;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=@ieOpacity)";
    filter: ~"alpha(opacity=@ieOpacity)";
}

When this is complied the code would look like this in the .css file (Opacity=@ieOpacity)

Was it helpful?

Solution

The answer is simple, add @{var} so that less knows its a variable and not text

-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=@{ieOpacity})";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top