Do I use , <>, >

后端 未结 15 2040
借酒劲吻你
借酒劲吻你 2020-11-22 06:10

Should I use , , or for loading SVG files into a page in a way similar to loading a jpg
15条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 07:13

    My two cents: as of 2019, 93% of browsers in use (and 100% of the last two version of every one of them) can handle SVG in elements:

    Source: Can I Use

    So we could say that there's no reason to use anymore.

    However it's still has its pros:

    • When inspecting (e.g. with Chrome Dev Tools) you are presented with the whole SVG markup in case you wanted to tamper a bit with it and see live changes.

    • It provides a very robust fallback implementation in case your browser does not support SVGs (wait, but every one of them does!) which also works if the SVG isn't found. This was a key feature of XHTML2 spec, which is like betamax or HD-DVD

    But there are also cons:

    • there isn't an AMP counterpart to (tho it's perfectly safe to use it with and use it inline too.
    • you shouldn't mix serviceworker fetch handler with any kind of embed, so having an tag might keep your PWA from being really offline capable.

      提交回复
      热议问题