Is there an equivalent of spriting for SVG images in web pages?

前端 未结 4 1194
生来不讨喜
生来不讨喜 2021-02-08 19:10

SVG images aren’t bitmaps, so (unless I’m missing something) you can’t do spriting like you can with other images files used on web pages (see http://www.alistapart.com/articles

4条回答
  •  梦谈多话
    2021-02-08 19:50

    You can use 'traditional' CSS sprite techniques to slice up SVG images with background position, here's a quick example, though it does get a little confusing if you also start using background-size. It's probably easier if you define a size on your SVG image:

    
    

提交回复
热议问题