Image. The HTML <img> tag is used for embedding images into an HTML document.

Required Attributes

  • src is used to specify the location of the image file.
  • alt is used to specify the alternative text of the image, which should be a short description.

Optional Attributes

  • longdesc can be used to specify the location (in the form of a URI) of a description of the image.
  • height can be used to define the height of the image (in pixels). This can also be done with CSS.
  • width can be used to define the width of the image (in pixels). This can also be done with CSS.
  • Common attributes

Example

<img src="http://lisiasloback.com/default/img/lisiasloback.jpg" alt="London @ night" />

Changes in HTML5

  • None.

Related Tags