Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.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
Google chrome Chrome不渲染svg图像_Google Chrome_Svg_Fullscreen - Fatal编程技术网

Google chrome Chrome不渲染svg图像

Google chrome Chrome不渲染svg图像,google-chrome,svg,fullscreen,Google Chrome,Svg,Fullscreen,我在渲染svg图像时遇到问题,但仅在Chrome中(FF、IE、Edge都可以)。我只能从图像中看到文本,但并没有任何背景颜色从图像等。我需要有全屏图像,这是我的代码。谁能帮我一下,chrome的问题在哪里?如何解决 <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body

我在渲染svg图像时遇到问题,但仅在Chrome中(FF、IE、Edge都可以)。我只能从图像中看到文本,但并没有任何背景颜色从图像等。我需要有全屏图像,这是我的代码。谁能帮我一下,chrome的问题在哪里?如何解决

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body, html {
  height: 100%;
  margin: 0;
}

.bg {
  /* The image used */
  background-image: url("bg.svg");

  /* Full height */
  height: 100%; 

  /* Center and scale the image nicely */
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
</style>
</head>
<body>
<div class ="bg"> </div>



</body>
</html>

正文,html{
身高:100%;
保证金:0;
}
.bg{
/*使用的图像*/
背景图片:url(“bg.svg”);
/*全高*/
身高:100%;
/*将图像居中并精确缩放*/
背景位置:中心;
背景重复:无重复;
背景尺寸:封面;
}

没有进一步的信息,我们只能说
您的代码工作正常

我所做的只是将url从svg文件更改为公共占位符svg图像。如您所见,显示此文件没有任何问题

body,html{
身高:100%;
保证金:0;
}
.bg{
/*使用的图像*/
背景图像:url(“https://placeholder.pics/svg/300");
/*全高*/
身高:100%;
/*将图像居中并精确缩放*/
背景位置:中心;
背景重复:无重复;
背景尺寸:封面;
}

svg的内容是什么?您提供给我们的代码应该在chrome中运行,因此我们无法处理这些有限的信息。它只是简单的图像。背景是绿色,还有一句话。也许,把它转换成其他格式会更好吗?如果你有一个简单的svg,你的解决方案应该可以工作。尝试修复所有HTML语法错误(您在
=
之间有一个空格,删除此项可能会修复您的问题。它无法解决问题:(