Html Images

Images are very useful to increase the beauty of a website. It is true that one single image is worth than thousands of words. In Html, images are defined with the <img> tag. To display an image on a page, you need to use the src attribute. Src stands for "source". The value of the src attribute is the URL of the image you want to display.

Use the <img /> tag to place an image on your webpage. Like the <br /> tag, <img /> tag does not require a formal ending tag. Instead, all we need to do to close this tag out with a slash (/) placed just inside the ending bracket (/>).

<img /> Attributes

Attribute Description
srcSpecifies the URL of the image file.
altSpecifies an alternate text which will be displayed if image is missing.
titleSpecifies a text title for the image.
widthSpecifies width of the image.
heightSpecifies height of the image.
borderSpecifies a border around the image.
alignSpecifies horizontal alignment of the image.
valignSpecifies vertical alignment of the image.

<img /> example

<img src = "filename.jpg" width = "200" height = "200" border = "2" />

<img src = "filename.jpg" align = "center" valign = "middle" />

Recommended for you