2
I’m trying to set an icone.svg in the system and something went wrong: the icon does not appear on the screen... I think it might be the coordinate system. I’m having doubts about how to resize the images and about that coordinate system.
I don’t quite understand the properties height
, width
and viewBox
.
What happens if you use them together? And what happens if you omit height
and width
?
Follow the codes:
(the doc svg of the icon heart.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 place the 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 with details, because so far this nagging doubt has not been resolved.
I don’t have time to go into details now (I would like to, but I’m kind of busy) but I already say that for your case will be something like this:
<svg viewBox="0 0 430 430">
- if no one gives an elaborate answer, I may post something tomorrow– Bacco
Thank you very much @Bacco, I would like! Nice work meanwhile.
– Lucas Trino