V
V
Vitaly2020-04-16 15:46:30
css
Vitaly, 2020-04-16 15:46:30

Is it possible to mixin inside box-shadow?

Good afternoon.

Experimenting with box-shadow in scss. I need to add several shadows for one element, I want to make some of them using mixins.

Can I make a mixin that, depending on the input parameters, will generate strings like this:

0 1px 0 0 black, 
0 10px 0 0 white, 
0 20px 0 0 red,


And then use it like this:
Box-shadow: @import mixin(params) 
@import Mixin2(params) 
@import mixin(other params) ;


This code doesn't compile to css for me. Is there a way? The point is not to generate a set of box-shadows, as they will overlap each other. And to generate a set of parameters and substitute them in one box-shadow.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Morev, 2020-04-16
@Tratatuy

Good afternoon.
Use not a mixin, but a function - and you will be happy.

D
dom1n1k, 2020-04-17
@dom1n1k

Less can mix compound properties.
And for Sass you have to use functions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question