Thursday, January 6, 2011

The img Element

The img element is used to insert an image into an (X)HTML page. It is an inline replaced element. It is an empty element. The URI of the image is defined by the src attribute. Any image format that the browser supports can be used. Common formats are JPEG, PNG and GIF.

The src and alt attributes are required.

Attributes

Core Attributes
The core attributes can be applied to this element.
align
This is a deprecated attribute. It specifies the alignment of the image. Its value can be bottom, or left, or middle, or right, or top. Since this a presentational attribute, it is preferable to use CSS instead.
bottom
Aligns the image to the baseline
middle
Aligns the vertical middle of the image to the baseline
top
Aligns the top of the image to the top of the line box.
left
Aligns the image to left edge of the line box
right
Aligns the image to the right edge of the line box
alt
This is a required attribute. The value of this attribute is a short description of the image. It is displayed when the image cannot be loaded. It may also be used by non-visual browsers.
border
This is a deprecated attribute. Its value is a number that specifies the width of the border in pixels that surrounds the image. Since this is a presentational attribute, it is preferable to use the CSS border property instead.
height
This attribute specifies the height of the image. Using this attribute may speed up the rendering of the page because the browser can allocate space for the image before it is fully loaded. Since this is a presentational attribute, it is preferable to use the CSS height property instead.
hspace
This is a deprecated attribute. Its value is a number that specifies the width in pixels of the right and left margins of the image. Since this is a presentational attribute, it is preferable to use the CSS margin property instead.
ismap
This attribute takes only one value and is specified as follows: ismap="ismap". It indicates that the image is part of an server-side image map.
longdesc
The value of this attribute is a URL to a document that has a description of the image. This will help those who are browsing the document non-visually. However, visual browsers such as Firefox, Internet Explorer, etc. do not provide any method to view the document specified in longdesc.
name
This attribute is deprecated in XHTML. It is better to use the id or class attribute in both HTML and (X)HTML documents.
src
This is a required attribute. Its value is the URI of the image that is to be embedded.
usemap
This attribute is used to specify the map element that contains the client-side image map information of the iamge. The value of this attribute is the name (in case of HTML) or the id (in case of XHTML), prefixed with a hash (#) of the map element.
vspace
This is a deprecated attribute. Its value is a number that specifies the width in pixels of the top and bottom margins of the image. Since this is a presentational attribute, it is preferable to use the CSS margin property instead.
width
This attribute specifies the width of the image. Using this attribute may speed up the rendering of the page because the browser can allocate space for the image before it is fully loaded. Since this is a presentational attribute, it is preferable to use the CSS width property instead.

1 comment:

QualityPoint said...

yeah a nice blog to read ..even though the contents are less it has got lot of useful information..I feel that you could have added information about .You can test your knowledge in html by attending HTML Quiz .