Can we use SVG element without height and width attributes in HTML??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we use SVG element without height and width attributes in HTML???

6th Sep 2020, 3:15 AM
Aditya kumar Singh
Aditya kumar Singh - avatar
2 Answers
+ 3
Yes, default width and height are 300px and 150px
6th Sep 2020, 3:23 AM
v@msi😉
v@msi😉 - avatar
+ 2
Actually you shouldn't use the width and height attribute. Use CSS to set width and height of SVG elements depending on screen size. Use viewBox attributes to set the view box of SVG My video tutorial about viewBox: https://youtu.be/NwhRS6VUwVU
6th Sep 2020, 4:28 AM
Gordon
Gordon - avatar