简体   繁体   English

用作CSS背景时的SVG滤镜质量

[英]SVG filter quality when used as CSS background

I am trying to use a SVG file as a background for a div and everything is working just fine except when I add a filter to the SVG file it displays very rough. 我正在尝试将SVG文件用作div的背景,并且一切工作正常,只是当我向SVG文件添加过滤器时,它显示得非常粗糙。 Is there some sort of setting that I need to add in the CSS or inside the SVG file to increase the quality? 我需要在CSS或SVG文件中添加某种设置以提高质量吗? I have a web application that has a bunch of icons and was trying to lighten up the site by loading one file and offsetting the backgrounds but still keeping the quality high and having the icons scalable. 我有一个带有一堆图标的Web应用程序,并试图通过加载一个文件和补偿背景来减轻站点亮度,但仍保持高质量并具有可缩放的图标。 Am I going about this the wrong way? 我会以错误的方式处理吗?

I am using Inkscape to generate the SVG file 我正在使用Inkscape生成SVG文件

Here is my CSS: 这是我的CSS:

.icoErase{
   width: 1em;
   height: 1em;
   background-image: url('../images/FormIcons.svg');
   background-size: auto 6em;
   background-position: -1em -1em;
   background-repeat: no-repeat;
}

我可能建议在SVG中的filter元素上设置一个显式的filterRes属性,范围从1000到2000。浏览器有时会选择不正确的默认设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM