Intro to HTML HTML Tags HTML file HTML heading HTML line breaks HTML Lists HTML Divs HTML images HTML Attributes HTML hyperlink HTML Comment HTML Embed

HTML Inserting Images


The HTML tag is used to embed an image in a web page. Images are not technically inserted into a web page; images are linked to web pages. The 'img' tag creates a holding space for the referenced image.


The 'img' tag has two required attributes:


'src' attribute

As this attribute specifies the root of the img, it needs to be given correctly including the img type(.png/.jpeg).


Linking img from the file location:

If the image is in the file where your HTML file is, then you have link it like this:



If the image is one file away from the file where your HTML file is, then you have link it like this:



If the image is two file away from the file where your HTML file is, then you have link it like this:



Each dot(.) before the slash denotes number of files away from the HTML file

1 dot= one file away

2 dot= two file away

3 dot= three file away

4 dot= four file away