Learning Resources
 

img tag for images


The image tag is used to place an image on the web page. In its most simple form it looks like this:


It is very important to understand that images are not technically "part" of the web page file, they are separate files which are inserted into the  page when it is viewed by a browser. So a simple web page with one image is actually two files - the HTML file and the image file. The example on the right illustrates this.

In this example the two files are both located in the same folder. The HTML file includes an image tag which refers to image1.jpg. When the HTML file is displayed in a browser, it requests the image file and places it on the page where the tag appears. As you can see, the most important attribute of the image tag is src, which means source and tells the browser where the image file is.