SVG <defs> and <symbol> elements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

SVG <defs> and <symbol> elements

I'm a little confused, I do understand symbol can create an icon by using the viewBox attribute which then you can use by adding the <use> element and scale it with height and width attributes, when you don't use viewBox however doesn't symbol work pretty similar to defs element? They both duplicate whatever shape and animation is inside them, whats the diffefence? When do I use symbol and when do I use defs? Also, can't I use <q> element to duplicate multiple shapes as well?

15th Jul 2020, 9:17 PM
Karak10
Karak10 - avatar
2 Answers
22nd Jul 2020, 11:40 PM
Karak10
Karak10 - avatar
18th Jul 2020, 3:39 PM
Vachila64☕
Vachila64☕ - avatar