Justin
Justin

Reputation: 77

how to set svg pattern as html background

I'd like to have a pattern I made in an embedded SVG appear as the background of an html doc.

<head>
<style>
body{
    background-image: url('apattern.svg');
}
</style>
</head>

Upvotes: 1

Views: 462

Answers (1)

rfornal
rfornal

Reputation: 5122

Basically, SVGs do not work well in body-background as you described in the question, if at all. What I've done is create a fallback option for those browsers that have an issue.

body {
  background: url(fallback.png);
  background-image: url(image.svg), none;
}

See ... http://css-tricks.com/using-svg/

Upvotes: 1

Related Questions