Friday, 10 August 2012

HTML Images:


Insert image – The <img> Element:

You will insert any image in tour web page by using <img> tag. Following is the simple syntax to use this tag.

<img src= “image URL” attr_name=”attr_value” … more attributes />

Image Attributes:

Following are most frequently used attributes for <img> tag.

·         Width: sets width of the image. This will have a value like 10 pr 20% etc.
·         Height: sets height of the image. This will have a value like 10 or 20% etc.
·         Border: sets a border around the image. This will have a value like 1 or 2 etc.
·         Src: specifies URL of the image file.
·         Alt: this is an alternate text which will be displayed if image is missing.
·         Align: this sets horizontal alignment of the image and takes value either left, right or center.
·         Valign: this sets vertical alignment of the image and takes value either top, bottom or center.
·         Hspace: horizontal space around the image. This will have a value like 10 or 20% etc.
·         Vspace: Vertical space around the image. This will have a value like 10 or 20% etc.
·         Name: name of the image with in the document.
·         Id: id of the image within the document.
·         Style: this will be used if you are using CSS.
·         Title: specifies a text title. The browser, perhaps flashing the title when the mouse passes over the link.
·         ismap and usemap: These attributes for the <img> tag tell the browser that the image is a special mouse-selectable visual map of one or more hyperlinks, commonly known as an image map.

No comments:

Post a Comment