简体   繁体   中英

How can I make an svg a background image with the body tag?

I am really racking my brain at the moment, because I can't seem to find a way to make an svg into a background image. Currently this is my code:

<body style="background:url(images/bg.jpg) fixed; background-size:cover;">

But if I change that to an svg I have, it doesnt show the background any more, and if I try and put that into the CSS like this;

body {
background: url(images/bg.jpg) fixed;
background-size:cover;

it doesn't show up anymore, so it clearly has to be in the HTML unless there is a better way to do it.

Please help!

Thanks

-Dan

The SVG images should be supported by the browser in order to display. Here I have found a good artical for SVG images and their support: http://css-tricks.com/using-svg/

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