Answer the question
In order to leave comments, you need to log in
How to work with svg sprites?
In general, I collected a sprite in gulp svg through symbol. it looks like:
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="gamecontroller" viewBox="0 0 64 64"> ... </symbol>
<symbol id="icons-11" viewBox="0 0 65 65"> ... </symbol>
</svg>
.my-icon {
display: inline-block;
vertical-align: middle;
width: 100px;
height: 100px;
background: url('svg-symbols.svg#gamecontroller') no-repeat;
background-size: contain;
}
Answer the question
In order to leave comments, you need to log in
1. symbol is a descriptive element, it is not displayed, but it can be used in the use element
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="gamecontroller" viewBox="0 0 64 64"> ... </symbol>
<symbol id="icons-11" viewBox="0 0 65 65"> ... </symbol>
<use xlink:href='#gamecontroller' />
</svg>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question