1

I'm using SVG for my footer background. Here's my code:

#footer-bg {
  background-image: url("/assets/main-bg.svg#svgView(viewBox(2,0,590,700))");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

This is working in all browsers except Safari, and the culprit is the SVG identifier #svgView(viewBox(2,0,590,700)). When I tried to put the viewbox inside SVG file, it is working in Safari.

Is there a way to fix this?

NearHuscarl
  • 38,825
  • 11
  • 144
  • 140
Newboy11
  • 2,152
  • 3
  • 21
  • 32

1 Answers1

-1

Absolutely you can use a hack to use a media query to target only Safari browser and then modify that background-image value with the correct one for that browser. In this StackOverflow post you can have more info about those media queries.

Besides that, if you want to have that viewbox set for the SVG, why you don't just edit the svg file, setting that viewbox directly in there and removing it from the css?

Agustin Moles
  • 1,256
  • 6
  • 14
  • I have multiple pages that uses that svg file. I added svg identifier so I can only have one file and just change the viewbox value in css – Newboy11 Oct 07 '20 at 01:14