I'm trying to set an icone.svg on the system and something went wrong: the icon does not appear on the screen ... I think it may be the coordinate system. I am having doubts on how to resize the images and on such a coordinate system.
I did not understand the properties height
, width
and viewBox
.
What happens if I wear them together? And what happens if you omit height
and width
?
Here are the codes:
(the doc svg of the icone coracao.svg )
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="coracao">
<path fill="red" d="M401.788,74.476c-63.492-82.432-188.446-33.792-188.446,49.92
c0-83.712-124.962-132.356-188.463-49.92c-65.63,85.222-0.943,234.509,188.459,320.265
C402.731,308.985,467.418,159.698,401.788,74.476z" />
</symbol>
</defs>
</svg>
(the HTML doc div where I want to put icone.svg with the size of 50px 50px)
<div id="amei" title="amei">
<svg viewBox="0 0 50 50">
<use xlink:href="coracao.svg#coracao" />
</svg>
</div>
I would like an explanation in detail, because until now this boring doubt has not been remedied.