You are currently using a web browser that does not support HTML 5 with style sheets. Please try the standard HTML 5, XHTML 1 or XHTML 1 Mobile version of this page instead.

The <img/> Tag

The <img/> tag in HTML 5

Since img is a void element, it should always be coded as an empty tag: <img .../>.

Converting to HTML 5

We are working on converting to HTML 5. Please visit HTML <img> Tag on the HTML 5 standard version of this site.

<img> Tag Syntax

Syntax of the <img> tag

Attributes of the <img> Tag

Attributes of the <img> tag

attribute
The attribute
common attributes
In addition to the attributes above, which are specific to the <img> tag, any of the common HTML attributes can also be used.

HTML Best Practices for Usage of the <img> Tag

Include a description of the image in the alt attribute of each img tag for use by non-visual clients such as auditory browsers, and as an alternative in case the image is unavailable for some reason.

HTML 5 Examples

Examples of the img tag in HTML 5

<img src="html-5-logo.png" alt="HTML-5"/>


Changes in HTML 5

What's new in HTML 5

Differences between HTML 5 and earlier versions

The following attributes should not be coded on the <img> tag because they either have been deprecated or were never officially supported:

  • align
  • border
  • controls
  • dynsrc
  • hspace
  • loop
  • start
  • vspace

Last updated Sunday September 19, 2010


Printer-friendly PDF* format:

HTML <img/> Tag

You are currently viewing this page in HTML 5 Style Sheet* format (* see Clicklets for more infomation). This document is also available in HTML 5 XML*HTML 5 non-XML*XHTML 1 Style Sheet*XHTML 1*XML* HTML 4* XHTML Mobile* WML Mobile* and printer-friendly PDF* formats. This is accomplished with Single Source Publishing, a content management system that uses templates in XSLT style sheets provided by XML Styles .com to transform the source content for various content delivery channels. There is also RDF* metadata that describes the content of this document.