css3 sprite map

1. Download Firework
insert image description here
2. Open the sprite in Firework,
insert image description here
you must first lock it and then change the width, otherwise the sprite will be deformed

3. The picture required for cutting.
insert image description here
The picture width/height is 23px, the x coordinate is 59, and the y coordinate is 194

4. Add to the css code


.user::before{
    
    
    content: "";
    display: block;/*行元素无大小,需改为块*/
    /*图片的宽高*/
    width: 23px;
    height: 23px;
    /*关键代码*/
    background:url(../images/sprite.png) no-repeat -59px -194px;
    /* 缩放 */
    background-size: 104px auto;
    margin: 4px auto 0;
}

Guess you like

Origin blog.csdn.net/weixin_45090657/article/details/123445544