nikoo
V2EX  ›  问与答

SVG 图标可以用在生产环境吗?有没浏览器不支持?

  •  
  •   nikoo · Oct 16, 2020 · 2638 views
    This topic created in 2065 days ago, the information mentioned may be changed or developed.
    移动端浏览器与 PC 端目前分别是什么情况?
    10 replies    2020-10-16 14:22:57 +08:00
    xycool
        1
    xycool  
       Oct 16, 2020   ❤️ 1
    nikoo
        2
    nikoo  
    OP
       Oct 16, 2020
    @xycool 谢谢,项目本来就不支持 IE8,是不是可以安心上 SVG 了?
    xycool
        3
    xycool  
       Oct 16, 2020
    @nikoo #2 如果没有动画效果,问题不大,如果有动效的话可能要再考虑一下了。
    nikoo
        4
    nikoo  
    OP
       Oct 16, 2020
    是普通的静态图标

    我看 bilibili 、acfun 首页都用了,是不是目前浏览器基本都兼容了?
    imn1
        5
    imn1  
       Oct 16, 2020
    @xycool #3
    @nikoo
    我觉得相反,如果不是漂浮那种动态,非位图,应该上 svg,可以编程动画,而且 svg 是 xml 文本,可以程序生成
    位图就没必要了,只是插入 base64
    webshe11
        6
    webshe11  
       Oct 16, 2020
    @xycool 没毛病 can i use 就完事了
    ETiV
        7
    ETiV  
       Oct 16, 2020 via iPhone
    svg 遇到过某些 cdn 识别错误,导致了因为下发的 content type 头是 text/xml 、而无法在浏览器里正常工作的问题
    treblex
        8
    treblex  
       Oct 16, 2020
    https://caniuse.com/?search=svg

    小程序似乎不支持
    kokutou
        9
    kokutou  
       Oct 16, 2020
    微信的垃圾内置浏览器呢...
    TomVista
        10
    TomVista  
       Oct 16, 2020
    微信小程序 svg 可以通过 backgroundimage base64+svg 解决,

    不能直接用 svg 标签,

    而其他支持 svg 标签的浏览器,都能够兼容小程序解决方案,

    目前我是这么处理的..
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1507 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 63ms · UTC 16:45 · PVG 00:45 · LAX 09:45 · JFK 12:45
    ♥ Do have faith in what you're doing.