Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If you use sprites... sticking to a grid system makes it so much easier in
- SASS... I didnt do it on the last project I used a big sprite sheet on...
- but I will do it on the next one having played with it.
- Basically, I made a spritesheet where everything's top-left was on a 20x20
- grid corner. Some things took up multiple grid squares, but the top-left
- was always in a grid corner. Then i just a mixin with variables for the
- column and row of the sprite
- Then, in SASS/SCSS
- $grid_spacing = 20;
- @mixin sprite($x, $y) {
- background-image: url(mysprite.png)
- background-position: -#{$x*!grid_spacing} -#{$y*!grid_spacing}
- }
- .mySpriteButton
- @include sprite(3, 5)
- width: 200px
- height: 50px
Add Comment
Please, Sign In to add comment