Use of <use> :
Unfortunately, this method does not work in IE, even in version 11. There is a script that processes the corresponding links for browsers where they do not work.
Also be careful: in Сhrome it is impossible to use filters on such elements. Objects with filters applied both from inside and to the use element itself also use . In addition, objects with filters from external files disappear. This bug they can not solve for 5 years
<svg height=0 > <g id="arrow"> <polygon points="38.25,0 38.25,357 318.75,178.5" /> </g> </svg> Тест: <svg> <use xlink:href="#arrow"/> </svg>
If svg is in an external file, you need to specify the path to it:
<!-- `<use>` внутри документа --> <svg viewBox="0 0 100 100"> <use xlink:href="#icon-1"></use> </svg> <!-- `<use>` во внешнем файле--> <svg viewBox="0 0 100 100"> <use xlink:href="path/to/defs.svg#icon-1"></use> </svg>
Use <use> and CSS styling:
.marker use{ fill:red; }
<svg height=0 > <g id="arrow"> <polygon points="38.25,0 38.25,357 318.75,178.5" /> </g> </svg> Тест: <span class="marker"> <svg> <use xlink:href="#arrow"/> </svg> </span>
Using <svg> as an inline image in CSS:
There is a more cross-platform method. List markers can be done like this:
.arrow { background: url('data:image/svg+xml,%3Csvg%20%20%20xmlns=%22http://www.w3.org/2000/svg%22%20%20%20viewBox=%22-2%20-2%2022%2044%22%20width=%2220%22%20height=%2240%22%3E%3Cpath%20d=%22M%2010,0%200,20%2010,40%22%20style=%22fill:none;fill-rule:evenodd;stroke:#CCCCCC;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1%22%20/%3E%3Cpath%20d=%22M%2020,0%2010,20%2020,40%22%20%20%20%20style=%22fill:none;fill-rule:evenodd;stroke:#CCCCCC;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1%22%20/%3E%3C/svg%3E'); width: 20px; height: 40px; }
<div class=arrow></div>
SVG encoded via encodeURI:
console.log(encodeURI('<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 22 44" width="20" height="40"><path d="M 10,0 0,20 10,40" style="fill:none;fill-rule:evenodd;stroke:#CCCCCC;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /><path d="M 20,0 10,20 20,40" style="fill:none;fill-rule:evenodd;stroke:#CCCCCC;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /></svg>'))
The resulting is placed in the CSS in this way:
background: url('data:image/svg+xml,[код картинки]')