How to use .svg files in a webpage?

前端 未结 7 1525
长情又很酷
长情又很酷 2021-01-30 19:37

I want to know how can one actually use a .svg file In a web page?

7条回答
  •  情话喂你
    2021-01-30 20:17

    If all you want to do is to place an SVG image such as a logo or static diagram, you just need to be careful to provide a fallback for older versions of Internet Explorer (i.e. versions 8 and earlier).

    The best and simplest method I've found is to use a .png or .jpg for your fallback, placed using a normal img tag. You then wrap the img tag in an object tag, using the data attribute to place the SVG.

    
      
    
    

    The img fallback is only loaded and used if the browser doesn't understand SVG.

提交回复
热议问题