Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何应用SVG使其在IE背景图像中工作_Html_Css_Internet Explorer_Svg - Fatal编程技术网

Html 如何应用SVG使其在IE背景图像中工作

Html 如何应用SVG使其在IE背景图像中工作,html,css,internet-explorer,svg,Html,Css,Internet Explorer,Svg,我的问题类似于中的问题讨论。背景图像可以在包括IE10在内的所有其他浏览器中使用,但在IE10以下的浏览器中不起作用。在阅读了这篇文章之后,我为下面的IE10创建了一个SVG格式的背景图像。现在,我不知道如何将它应用到我的CSS中 CSS .bg-secondary { background: url(../img/design/bg-secondary.jpg) no-repeat top center; -webkit-background-size: 100

我的问题类似于中的问题讨论。背景图像可以在包括IE10在内的所有其他浏览器中使用,但在IE10以下的浏览器中不起作用。在阅读了这篇文章之后,我为下面的IE10创建了一个SVG格式的背景图像。现在,我不知道如何将它应用到我的CSS中

CSS

.bg-secondary { 
        background: url(../img/design/bg-secondary.jpg) no-repeat top center; 
      -webkit-background-size: 100% auto;
      -moz-background-size: 100% auto;
      -o-background-size: 100% auto;
      background-size: 100% auto;
      min-height: 605px;
        filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/design/bg-secondary.svg', sizingMethod='scale');
    }

您可以在此处使用具有多个背景的css技术:

  .bg-secondary {
  background-image: url(fallback.png);
  background-image: url(image.svg), none;
  -----
  -----  
  }
这是因为浏览器对SVG的支持恰到好处 多个背景非常相似。如果需要多个背景 支持,浏览器将使用第二个声明(带SVG), 否则返回到第一个声明(使用PNG)

更新:

<svg width="--" height="--">
  <image xlink:href="your.svg" src="svg.png" width="--" height="--" />
</svg>

如果有帮助,试试这个

<svg  height="--px" width="--px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                                            <image width="100%" height="100%" xlink:href="imagefilehere.svg"/>
                                    </svg>


@NavneilNaicker您可以尝试使用更新的格式吗?它不作为背景图像应用,但仍需检查,因为我目前没有IE浏览器。出于安全原因,大多数浏览器不允许img元素和css(背景)图像加载额外的外部资源。我的猜测是IE也会阻止这样的引用,这意味着在示例
中它不会显示内部的图像(除非它可能被编码为数据uri)。您可以将替换为,例如,以测试svg本身是否正确加载。