See this example :
In HTML, images are defined with the <img> tag.
The <img> tag is empty, it contains attributes only, and does not have a closing tag.
The src attribute specifies the URL (web address) of the image:
The alt attribute provides an alternate text for an image, if the user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).
If a browser cannot find an image, it will display the value of the alt attribute:
See this example :
The alt attribute is required. A web page will not validate correctly without it.
You can use the style attribute to specify the width and height of an image.
The values are specified in pixels (use px after the value):
See this example :
Alternatively, you can use the width and height attributes. Here, the values are specified in pixels by default:
See this example :
Note: Always specify the width and height of an image. If width and height are not specified, the page will flicker while the image loads.
Both the width, height, and style attributes are valid in HTML5.
However, we suggest using the style attribute. It prevents internal or external styles sheets from changing the original size of images:
See this example :
If not specified, the browser expects to find the image in the same folder as the web page.
However, it is common to store images in a sub-folder. You must then include the folder name in the src attribute:
See this example :
Some web sites store their images on image servers.
Actually, you can access images from any web address in the world:
See this example :
To use an image as a link, simply nest the <img> tag inside the <a>tag:
See this example :
Note: border:0; is added to prevent IE9 (and earlier) from displaying a border around the image (when the image is a link).
Use the CSS float property to let the image float to the right or to the left of a text:
See this example :