HTML img tag is used to insert image in your web page.
Syntax: <img src="filename.ext">
To apply image, img tag must have src attribute, it specify the image URL (path).
HTML img tag is an empty tag, so there is no need to close it.
HTML img tag is an inline tag, means, if two or more images applied they appear in the same line. If the total image width is less than 100%.
Attribute | Description |
---|---|
Src | src specifies a source path for the image to be displayed on the webpage. |
Alt | Alt attribute specifies the Alternate text that appears when the image is unable to display. |
Title | Title attribute is used to provide information in the form of tooltip. |
Height Width | Specifies the height and width of the image. |
Align* | To change image alignment, possible values are: Left and Right. |
Border* | Specifies the thickness of a border to be drawn around the image. |
Hspace* | Specifies the margin space on the left and right side of an image |
Vspace* | Specifies the margin space on the top and bottom of an image. |
Exercise 1: Image Gallery. Click on the image to open it on a full screen in a new tab window.
Ad: