SVGs <use> and not...

Hi guys I really would aprecciate come help here. In this HMTL are two ways of using svgs but one of them is not getting the size of the actual svg (image) change it only changes the size of the container. The weird thing is that the two of them are responding to a change of color fill:red but just one is responding of a change of height. Can you figure out why? https://codepen.io/Ari-Cohelo/pen/WNYoBjR?editors=1101
8 Replies
MarkBoots
MarkBoots8mo ago
put the viewbox on the <symbol>
clevermissfox
clevermissfox8mo ago
mark , is it true you dont need the attr xmlns="http://www.w3.org/2000/svg" when using svgs inline in html?
MarkBoots
MarkBoots8mo ago
I don't use it all the time and never noticed any deficit. But can not say for sure, my svg knowledge is a bit weak (mostly i just copy paste from figma)
MarkBoots
MarkBoots8mo ago
Okay, so no, not necessary for inline svg inside a html document ref: https://stackoverflow.com/questions/18467982/are-svg-parameters-such-as-xmlns-and-version-needed
No description
ἔρως
ἔρως8mo ago
you shouldn't use the namespace in html and yes, the symbol is missing the viewbox also, make sure that the svg is visually hidden - doing display: none breaks animations on it
MarkBoots
MarkBoots8mo ago
xmlns == xml Name Space, now it makes sence in my head. will never forget 😉
clevermissfox
clevermissfox8mo ago
Glad it's clicked for you, it still floats around with ❓️❔️ around it for me 🤣
AriCohelo
AriCoheloOP8mo ago
OMFG Thank you!!
Want results from more Discord servers?
Add your server