<img> defines image and is used to embed an image in a web page. Images are not inserted in a web page, they are linked into a web page. <img> only creates a holding space for an image that it is linked to. There are two required attributes:
            src- specifies the path to the image
            alt- specifies an alternate text for the image
EX:<img src=”url” alt=”alternatetext”>
Image size uses style and it specifies the width and height of the image, the width and height attributes can also be used. The style attribute is recommended to prevent style sheets from changing the size of images.
EX: <img src=”img_girl.jpg” alt=”Girl in Jacket” style=”width:500px;height:600px;”>
OR <img src=”img_girl.jpg” alt=”Girl in Jacket” width=”500” height=”600”>
Images in another folder, like sub-folder, must include the folder name in the src attribute.
EX: <img src=”/images/html15.gif” alt=”HTML5 Icon” style=”width:128px;height:128px;”>
Animated Images (GIFs) are allowed in HTML
EX:<img src=”programming.gif” alt=”Computer Man” style=”width:48px;height:48px;”>
If you want an image wants to be used as a link you put the <img> inside the <a> tag
EX: <a href=”default.asp”>
            <img src=”smiley.gif” alt=”HTML tutorial” style=”width:42px;height:42px;”>
The CSS float property lets the image float to the right or left of a text
EX: <p><img src=”smiley.gif alt=”smiley face” style=”float:right;width:42px;height:42px;>The image floats on the left side of the text.</p>
Back to Top