Using an Data URI SVG as a CSS background image

后端 未结 3 1181
深忆病人
深忆病人 2020-12-31 07:53

Backstory:

  • Goal: create a triangular shadow that can be applied via CSS and is scale-independant (i.e. a vector, not a raster image)
3条回答
  •  自闭症患者
    2020-12-31 08:13

    See how the working fiddle has double quotes just inside the url() and then all the SVG content uses single quotes? You need to do the same. Otherwise the parser doesn't know where the url content ends.

    Alternatively you could make the url use single quotes and keep your SVG content the same.

    body { background-image: url('data:image/svg+xml;utf8,'); }
    

提交回复
热议问题