I have an SVG I would like to use as the icon on a <select>
element.
If I paste the following into a div by itself it works - the SVG renders and appears.
<svg xmlns='http://www.w3.org/2000/svg' width='15.826' height='9.413' viewBox='0 0 15.826 9.413'><path id='Path_100' data-name='Path 100' d='M175.428,127l6.5,7,6.5-7' transform='translate(-174.015 -125.584)' fill='none' stroke='#000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/></svg>
However, when I add it to CSS as a background image, eg:
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18.899' height='10.449' viewBox='0 0 18.899 10.449'><path id='Path_5' data-name='Path 5' d='M553.826,51.436l8.035,8.035,8.035-8.035' transform='translate(-553.826 -51.436)' fill='none' stroke='#fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/></svg>");
It doesn't work - nothing appears. However, I am able to get other SVG icons to appear using CSS.
My full CSS class is:
.select1 {
width: 50%;
-webkit-appearance: none;
-moz-appearance: none;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='15.826' height='9.413' viewBox='0 0 15.826 9.413'><path id='Path_100' data-name='Path 100' d='M175.428,127l6.5,7,6.5-7' transform='translate(-174.015 -125.584)' fill='none' stroke='#000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/></svg>");
background-repeat: no-repeat;
background-position-x: 98%;
background-position-y: 50%;
}
This fiddle demonstrates more clearly what I mean: https://jsfiddle.net/MeltingDog/uhter1f3/12/
Why does the SVG appear fine in HTML but not as a background image?