<img /> Description:
The IMG tag adds images and graphics to web pages.
IMG Web Browser Support:
- AvantGo Palm OS
- AvantGo Windows CE
- Chrome 1, 2, 3, 4, 5
- Firefox 1, 2, 3
- Internet Explorer 2, 3, 4, 5, 6, 7, 8
- Netscape 2, 3, 4, 6, 7, 8
- Opera 3, 4, 5, 6, 7, 8, 9, 10
- Safari 1, 2, 3, 4, 5
- WebTV/MSN TV
HTML Versions
IMG Attributes:
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.

