简体   繁体   中英

SVG as background-image?

I have an SVG file place in solution and I have a master page where I want to put that SVG as a background image. I have tried with:

html { background-image: url("../Images/MainBackground.svg"); }

But it does't work; the SVG doesn't appear at all.

Does anyone have any idea why?

Thanks in advance.

IMHO you should set background on "body" and not on "html".

BTW: that will not work with internet explorer.

EDIT:

Try this on you CSS

background-image: url(your-file.svg);
-o-background-size: 100% 100%;
-webkit-background-size: 100% 100%;
-moz-background-size: 100% 100%;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM