0

.test {
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 100 100' preserveAspectRatio='none'><defs><linearGradient id='bg' x1='0%' y1='0%' x2='100%' y2='0%'><stop offset='0%' style='stop-color:rgb(255,255,0);stop-opacity:1'/><stop offset='100%' style='stop-color:rgb(255,0,0);stop-opacity:1'/></linearGradient></defs><polygon fill='url(#bg)' points='0,100 100,0 100,100'/></svg>");
  width: 200px;
  height: 200px;
}
<div class='test'>
  test
</div>

Effect can be seen here: https://jsfiddle.net/6k4Le0so/

Anyone have any idea why this svg doesn't work as background? If saved to file, I can open it in Inkscape just fine.

Karl
  • 854
  • 9
  • 21
Łukasz Zaroda
  • 869
  • 2
  • 19
  • 55

0 Answers0