SVG icons vs. PNG icons in modern web sites

前端 未结 5 1930
轻奢々
轻奢々 2021-01-30 01:36

I\'m wondering why so few modern web sites still use only PNGs for icons (but this assumption is just based my observation). So far I know, main reasons for using PNGs over SVGs

5条回答
  •  野的像风
    2021-01-30 01:45

    Let's note that performancewise SVG can become horrible. Even on modern browsers, like Chrome (writing this in 2019 !), a CMS-like page with a few 100s (practically 3-800) of svg icons literally hangs the browser for 5+ seconds to finish rendering. Maxing out CPU meanwhile.

    As noted elsewhere, the count of SVGs embedded in the page expontentially increases the load on the browser, so if you happen to face such situation

    Option #1: convert svgs into webfont (See performance chart here:http://frozeman.de/blog/2013/08/why-is-svg-so-slow/ )

    Option #2: fall back to plain old PNGs

    In such situations where you ~never wanna do anything fancy like on-the-fly color modification, and you have MANY instances of SVGs, the old PNG does the job and saves the day!

提交回复
热议问题