@rafdidact
Posted
Hey, Siva!
- If your svg takes the role of an static image, an
img
tag will do the job. It allows for analt
property, which you should use:
<img src="image.svg" alt="cat">
- If you want a more powerful svg, use
object
. It allows for referring your svg from outer document, so that you can manipulate it with JavaScript:
<object id="svg1" data="image.svg" type="image/svg+xml"></object>
Hope it helps.
Marked as helpful
@sivakumars
Posted
Hi, @rafdidact!
Thanks a lot for your feedback.
Initially, I used <img />
tags for displaying images, then I thought I will use SVG sprites to replace three SVG images with one SVG image. Maybe , it doesn't matter much in this small challenge. Also , I learned a bit about how SVG viewbox and viewport works.
I think I should have used aria
tags to make those icons accessible. Thanks for introducing me to the object
element. I will keep this in my mind for SVG animations.