Your browser does not support JavaScript!
Upvotes Anonymous 0 User 0

How to create an image in HTML

You can show an image on the page using the <img> tag:
<img src="flowers.jpg" alt="Flowers in a garden">

The src attribute tells the browser where to find the image, and the alt attribute tells the browser what text to display if the image can't be found.
Why is there no closing tag?
Why is there no </img> tag? The <img> tag doesn't need a closing tag (see an explanation here). You can, however, add a forward slash into the opening tag:
<img src="flowers.jpg" alt="Flowers in a garden"/>
but it is not required.
Was this helpful?

Tags

Comments

Leave a Comment

I agree to the Terms of Service
Design © 2015, Downranked, LLC.,
Original user code contributions under MIT License