J
J
Junior Bee2016-10-03 15:10:28
css
Junior Bee, 2016-10-03 15:10:28

Mixin for sprite, scss?

Good afternoon! Please tell me how to correctly extract images from a sprite with sass. Pictures in a sprite of different sizes, using scss. It would be ideal to create a mixin with a loop that would immediately insert the background-position, to a class such as .item--(). I understand how it should be, but something got confused in these mixins.
I would be very grateful for your help!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikolai Shabalin, 2016-10-03
@nikolayshabalin

You cannot do this with SASS, because in essence, a sprite is a big picture and you need to show part of it and use background-position to move the sprite itself.
In total, SASS needs to know the size of the displayed part of the picture and the position of the displayed picture. He doesn't know how out of the box.
You can try Compass , or something more modern spriteSmith

S
sashabeep, 2016-10-04
@sashabeep

The compass can, but only in the opposite direction, when the sprite has not yet been created. He glues it himself.
We'll have to cut the finished sprite

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question