Loading...
HTML <img> Tag

HTML <img> Tag

In this tutorial, we will learn about img tag in HTML with the help of examples.


<img> Tag

Img tag <img> is used to insert link images in an HTML page.

Syntax

<img src = ""/>

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Img Tag</title>
  </head>
  <body>
    <img src = "../images/boat.png" width = "auto" height = "200px" />
  </body>
</html>

Output

Image not found

Specific Attribute

Attribute Value Description
align Left
right
top
middle
bottom
It specifies how to alignment of the image
alt text It specifies the alterate text for image.
border border_width border_type border_color It specifies the border around the image
crossorigin anonymous use-credentials It allows images from third-party sites that allow cross-origin access to be used with canvas
height pixels
percentage
It specifies the height of the image
hspace pixels It specifies the amount of whitespace to be inserted to the left and right of the object
longdesc text It specifies a URI/URL of a long description this can elaborate on a shorter description specified with the alt attribute
src URL It specifies the URL of an image
usemap #mapname It defines the image as a client-side image map and used alongwith <map> and <area> tag
vspace pixels It specifies the amount of whitespace to inserted to the top and bottom of the object
width pixels
percentage
It specifies the width of the image

Global Attribute

Img Tag support all the global attributes of HTML.


Event Attribute

Img Tag support all the event attributes of HTML.


Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of <img> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML <input> Tag.

- Related Topics