Pages

Wednesday, June 30, 2010

:: HTML Elements Part 7 ::

HTML Images is used to display image/s.It uses <img> tag and the src attribute.The <img> tag is empty, which means that it contains attributes only, and has no closing tag.To display an image on a page, you need to use the src attribute. Src stands for "source". The value of the src attribute is the URL of the image you want to display.

Syntax for defining an image:

<<img src="url" alt="text" />

HTML The Alt Attribute

The required alt attribute specifies an alternate text for an image, if the image cannot be displayed.The value of the alt attribute is an author-defined text:

<img src="ensem.gif" alt="Ensem" />

The alt attribute provides alternative information for an image if a user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).

For example :

<html>
<head>
<title> The seventh lesson </title>
</head>
<body>
<img src="ensem.gif" alt="Ensem" />
<img src="www.mutak.com/ensem.gif" alt="Ensem" />
</body>
</html>

In conclusion , the HTML Images do not require end tags. This syntax can be added in body section.

Making too many images can make loading images take long time.


0 comments: