2

I've been trying to use a SVG file as background for a header on my site, but it doesn't seem to show up in Webkit browsers (I tried Chrome and Safari; on mac). Firefox seems to display it correctly.

Here's my CSS:

header {
  overflow: auto;
  width: 100%;
  height: 80px;
  background: url(../img/navbg.svg) no-repeat;
  background-size: 100%;
  -o-background-size: 100%;
  -webkit-background-size: 100%;
  -moz-background-size: 100%;

  margin: 0 0 20px 0;
  padding: 0;

  border-bottom-left-radius: 5px;
  border-bottom-right-radius: 5px;

  box-shadow: inset 0 0 1px #fff, 
    inset 0 1px 0 rgba(255,255,255,.3),
    0 1px 2px rgba(0,0,0,.5);
}

Any ideas on how to fix this?

1
  • 3
    Will be awesome if you show your svg and show complete example where you have problem. Commented Jul 16, 2012 at 9:20

3 Answers 3

1

Check this , it may helps you. http://helephant.com/2009/08/12/svg-images-as-css-backgrounds/

Sign up to request clarification or add additional context in comments.

Comments

0

I found an example done in March 2012. With the warning:

"SVG included as CSS can't be scripted and positioning is hard. Therefore only use this method for background illustrations."

Hope this helps: http://tecfa.unige.ch/guides/svg/ex/html5/html5-with-css-background.html

Comments

0

Check if your SVG is missing height & width declarations. Without these, background SVG's won't show in Safari 5.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.