css - 不能在 Webkit 中使用 SVG 作为 CSS 背景

标签 css background webkit svg

我一直在尝试使用 SVG 文件作为我网站标题的背景,但它似乎没有出现在 Webkit 浏览器中(我尝试过 Chrome 和 Safari;在 Mac 上)。 Firefox 似乎可以正确显示它。

这是我的 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);
}

关于如何解决这个问题的任何想法?

最佳答案

检查这个,它可能对你有帮助。 http://helephant.com/2009/08/12/svg-images-as-css-backgrounds/

关于css - 不能在 Webkit 中使用 SVG 作为 CSS 背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11501330/

相关文章:

PHP 在后台运行 FFMPEG,并找出它何时完成

javascript - 转换 CSS 样式对 <a> 标签没有影响

css - Bootstrap 标签和输入字段不显示水平

javascript - 如何在 DOJO 的 Grey_CircularLinearGauge 中为一系列值添加差异颜色

html - rails : How to convert <img src= > to image_tag in rails app

html - 长页面高度和背景重复问题

css - 两个不同颜色的独立 CSS 样式背景图像

ios - 无法在 WKWebView 上使用 "&"字符进行谷歌搜索

javascript - 如何检测浏览器控制台/检查器是否*打开*?

css - z-index 问题 CSS