HTMLforall

  HTML | PHP | Forum

HTML <img> tag

Syntax

<img> - </img>

Definition and Usage

The IMG element embeds an image or a video clip in the document.

Required Attributes

Attribute Value Description
alt text Defines a short description of the image which is displayed as alternative text
src URL The URL of the image to display

Optional Attributes

Attribute Value Description
align top
bottom
middle
left
right
Specifies how to align the image according to surrounding text. Deprecated. Use style sheets instead.
border pixels Defines a border around an image. Deprecated. Use style sheets instead.
height pixels
%
Defines the height of an image
hspace pixels Defines white space on the left and right side of the image. Deprecated. Use style sheets instead.
ismap URL Defines the image as a server-side image map
longdesc URL  An URL to a document that contains a long description of the image
usemap URL Defines the image as a client-side image map. 
vspace pixels Defines white space on the top and bottom of the image. Deprecated. Use style sheets instead.
width pixels
%
Sets the width of  an image

Standard Attributes

id, class, title, style, lang, xml:lang

For a full description, go to Standard Attributes.

Event Attributes

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

For a full description, go to Event Attributes.

Example

Source Output
<img border="0" src="../../images/htmllogo.gif" width="120" height="60">
</img>

Home

Learn HTML
HTML Tutorial

HTML Reference
HTML by function
HTML by Alphabet

HTML events
HTML attributes
HTML color names

<!--...-->
<!DOCTYPE> 
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<b>
<base>
<basefont>
<bdo>
<big>
<blockquote>
<body>
<br>
<button>
<caption>
<center>
<cite>
<code>
<col>
<colgroup>
<dd>
<del>
<dfn>
<dir>
<div>
<dl>
<dt>
<em>
<fieldset>
<font>
<form>
<frame>
<frameset>
<h1> to <h6>
<head>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<isindex>
<kbd>
<label>
<legend>
<li>
<link>
<map>
<menu>
<meta>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<p>
<param>
<pre>
<q>
<s>
<samp>
<script>
<select>
<small>
<span>
<strike>
<strong>
<style>
<sub>
<sup>
<table>
<tbody>
<td>
<textarea>
<tfoot>
<th>
<thead>
<title>
<tr>
<tt>
<u>
<ul>
<var>

 

Copyright 2005-8 Sunilcare.  All Rights Reserved.
Comments or suggestions? Contact us.About us