Skip to content

Instantly share code, notes, and snippets.

@wilsoncook
Created February 3, 2015 09:21
Show Gist options
  • Save wilsoncook/1f440bbad400df08ec61 to your computer and use it in GitHub Desktop.
Save wilsoncook/1f440bbad400df08ec61 to your computer and use it in GitHub Desktop.
LESS工具库
//---精灵图操作
@spritePic: '../images/sprites.png'; //精灵图地址
.fn-setSprite (@width, @height, @x, @y) {
width: @width + 0px;
height: @height + 0px;
background: url(@spritePic) 0px - @x 0px - @y;
}
.fn-setSpriteXY (@x, @y) {
background-position: 0px - @x 0px - @y;
}
.fn-setSpriteY (@y) {
background-position-y: 0px - @y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment