The image tag allows you to add images to your page. You might notice that this tag looks a little different than those you've seen before. Unlike paragraph, header, or list tags, the image tag doesn't require a closing tag. All of the information needed to display your image is contained within the tag itself.
In order to tell the browser which file to use, extra information, called an attribute, is added to the image tag inside the brackets. The attribute src stands for source and tells the name of the image, and the attribute alt describes the image.
dog.jpg
in the same directory as the page. Image file names include extensions that tell the computer which type of image they are working with. Common extensions are .jpg
, .jpeg
, and .png
. Make sure to put quotation marks around your image filename. W3 Schools Links
Found a bug in the documentation? Let us know at documentation@code.org