把多个小的图片合并成一个大图,这个大图就叫精灵图。
只需要加载精灵图并通过添加背景图的以及background-position选择某个小图。
较少加载图片文件数量,提升加载效率。
div {
width:200px
height:200px
background: url(./sprite.jpg) no-repeat -280px -240px
}
把多个小的图片合并成一个大图,这个大图就叫精灵图。
只需要加载精灵图并通过添加背景图的以及background-position选择某个小图。
较少加载图片文件数量,提升加载效率。
div {
width:200px
height:200px
background: url(./sprite.jpg) no-repeat -280px -240px
}