M
M
Maxim Sofronov2016-04-08 17:52:43
css
Maxim Sofronov, 2016-04-08 17:52:43

How to set multiple values ​​in a variable for a mixin in LESS?

I write like this:

.scale3d(@x: 1, @y: 1, @z: 1) {
    transform: scale3d(@x, @y, @z);
}

@crease: 1.05, 1.05, 0;

.increase-hover-item {
    .scale3d(@crease);
}

It produces this code:
.increase-hover-item {
    transform: scale3d(1.05, 1.05, 0, 1, 1);
}

And you need this:
.increase-hover-item {
    transform: scale3d(1.05, 1.05, 1);
}

Question: is it possible to @creasetransfer all values ​​for @x, @y и @zone line in a variable? What am I doing wrong? :-)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
stasov1, 2016-04-11
@stasov1

Or you need to rewrite the mixin itself so that they take not 3 parameters, but 1

.scale3d(@x) {
    transform: scale3d(@x);
}

And then you can pass the string you need there, or look towards the @arguments property.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question