SVG as Data URI for background image

by jamesdh

HTML

<h1>SVG at a data URI for background images....</h1>
<p>just because you can, doesn't mean you should.<p>
    
<div id="svg"></div>

CSS

#svg {
    height: 200px;
    width: 200px;
    background-size: 100% 100%; 
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10'><linearGradient id='gradient'><stop offset='10%' stop-color='#F00'/><stop offset='90%' stop-color='#fcc'/> </linearGradient><rect fill='url(#gradient)' x='0' y='0' width='100%' height='100%'/></svg>");
    color: white; 
    text-shadow: 2px 2px rgba(0,0,0,0.4);
}

h1 {font-size: 20px;}