29) <IMG> Tag and the SRC Attribute
Images not only add beauty to a web page they also bring life to web page. Images can be sited in a web page by using <IMG> tag and set its SRC attribute equal to the URL of the image. The <IMG> tag is empty, which means that it contains attributes only, and has no closing tag and and is written as:
<IMG SRC = “URL”> Where IMG stands for image, SRC is the – Source of the image file, the source attribute tells the browser where to find the image. And URL – The URL points to the location where to find the image.
Example
<IMG SRC=shahidminar.jpg>
If an IMG tag is enclosed between the opening and closing P tags, the other image will start on a new line. Pictures on the web are usually either in gif or jpg format. The gif format is mostly used for pictures with solid blocks of color such as charts, or when an image requires a transparent background. The jpg format is suitable for pictures with slight color changes such as photos.
<IMG SRC = “URL”> Where IMG stands for image, SRC is the – Source of the image file, the source attribute tells the browser where to find the image. And URL – The URL points to the location where to find the image.
Example
<IMG SRC=shahidminar.jpg>
If an IMG tag is enclosed between the opening and closing P tags, the other image will start on a new line. Pictures on the web are usually either in gif or jpg format. The gif format is mostly used for pictures with solid blocks of color such as charts, or when an image requires a transparent background. The jpg format is suitable for pictures with slight color changes such as photos.
30) Attributes <IMG>
HEIGHT AND WIDTH
The height and width attributes enable you to specify the height and width of an image. The attribute values are specified in pixels.
Example
<HTML>
<HEAD>
<TITLE> IMG With Width and Height</TITLE>
</HEAD>
<BODY>
<IMG SRC =shahidminar.jpg width="150" height="120">
</BODY> </HTML>
The height and width attributes enable you to specify the height and width of an image. The attribute values are specified in pixels.
Example
<HTML>
<HEAD>
<TITLE> IMG With Width and Height</TITLE>
</HEAD>
<BODY>
<IMG SRC =shahidminar.jpg width="150" height="120">
</BODY> </HTML>
Figure : image
0 comments:
Post a Comment