Html Win 10 Chrome上svg背景大小(以像素为单位)显示错误
我创建了一个svg图像:Html Win 10 Chrome上svg背景大小(以像素为单位)显示错误,html,css,google-chrome,svg,Html,Css,Google Chrome,Svg,我创建了一个svg图像: <svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6"><style>.st0{opacity:.4;fill:#61ffb0;enable-background:new}</style><path class="st0" d="M0 0h1v1H0z"/></svg> .st0{不透明度:.4;填充:#61ffb0;启用背
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 6"><style>.st0{opacity:.4;fill:#61ffb0;enable-background:new}</style><path class="st0" d="M0 0h1v1H0z"/></svg>
.st0{不透明度:.4;填充:#61ffb0;启用背景:新建}
然后我将其用作一个div的背景:
.dotted_bg_dark {
background-image: url(img/pattern-green.svg);
background-size: 6px;
}
.darkbg {
background-color: #212734;
color: #fff;
}
<div class="darkbg dotted_bg_dark" style="height:500px;">Hello World</div>
。虚线\u背景\u暗{
背景图像:url(img/pattern green.svg);
背景尺寸:6px;
}
布莱克伯格先生{
背景色:#212734;
颜色:#fff;
}
你好,世界
显示正确(MacOS上的Google Chrome):
但是,在Windows 10上的Google Chrome上可以做到这一点(注意对角线扫描线):
为什么会发生这种情况以及如何修复它?打开.svg文件,在开头找到标记,并在其中添加以下属性:
preserveAspectRatio="none"
[来源][