1. Computing

Discuss in my forum

<img />

By , About.com Guide

<img /> Description:

The IMG tag adds images and graphics to web pages.

IMG Web Browser Support:

HTML Versions

IMG Attributes:

Global attributes, event attributes and:

IMG End Tag:

None. <img /> is a singleton tag.

IMG Contents:

None.

IMG Valid Context:

The <img /> tag is valid within the following tags:
a, abbr, acronym, address, applet, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noframes, noscript, object, p, q, s, samp, small, span, strike, strong, sub, sup, td, th, tt, u, var

IMG Usage:

Standard image in HTML:

<img src="/library/graphics/html.gif" width=50 height=50 alt="Your HTML Guide" border="0">

Same image in XHTML (note the closing slash):

<img src="/library/graphics/html.gif" width=50 height=50 alt="Your HTML Guide" border="0" />

An image aligned to the left, with text following it:

<img src="/library/graphics/html.gif" width="50" height="50" alt="Your HTML Guide" border="0" align="left"> And this text is to the right of the image

IMG Special Notes:

  • You should always resize your images so that they fit on the web page. Images that are resized in the browser look fuzzy and blurry.
  • You should also set the height and width of your images, either with the attributes or with CSS. This makes images load more quickly.
  • Alternative text using the alt attribute is required for valid HTML, and a good idea for accessible html.

More IMG Information:

  1. About.com
  2. Computing
  3. Web Design / HTML
  4. HTML and XHTML
  5. XHTML
  6. HTML Tags
  7. The IMG Tag - Images Web Graphics - XHTML 1.0 HTML 4.0 HTML5 Image Tags

©2013 About.com. All rights reserved.