SVG Using an Icon


The <use> element is often used for reuseable icons, in collaboration with the <symbol> element. That looks like this:

    <symbol viewBox="0 0 16 16" id="icon-star">
        <path d="M16 6.216l-6.095-.02L7.98.38 6.095 6.196 0 6.215h.02l4.912 3.57-1.904 5.834h.02l4.972-3.59 4.932 3.59-1.904-5.815L16 6.215" />

And the <use> element:

    <use xlink:href="#icon-star"/>

The <use> element copies the <symbol> and displays it. You can also override the styles on the <symbol> on individual <use> elements, e.g.

    .red {
        fill: red;

    <use class="red" xlink:href="#icon-star"/>