简体   繁体   中英

How to add png background image AND fill color to SVG?

I know this is possible for regular html elements, and I know how to add fill color or a background image to an SVG. But is doing both possible? I'm just trying to add a filter effect to these background(fill) colors.

.element {
  background-color: rgba(0,0,0,.1);
  background-image: url('images/filter/grunge.png');
}

Your question is unclear.

Do you mean like this?

 svg { background-color: blue; background-image: url(http://lorempixel.com/300/200/); background-repeat: no-repeat; filter: blur(3px); } 
 <svg width="400" height="200"> <circle cx="100" cy="100" r="50" fill="red"/> </svg> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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