ADDING IMAGES TAG - HTML TUTORIAL 9 STUDENTSBLOG100 - Anna University Multiple Choice Questions

ADDING IMAGES TAG - HTML TUTORIAL 9 STUDENTSBLOG100


  • We can display images in html by using img tag. Images can be displayed as a link too.
  • In html, we can align the image in left, right and center by using normal alignment method.
  • Width and height of images can be set by adding normal width and height attributes inside img tag.
Syntax:
<img src = "image_link.extension" />

The src attribute suggests us to give the image file name. Along with the file name, we should give actual file path too.. 

For example:
<img src="C:\Images\cars\maruthi\swift.jpg" width="20px" height="10%" />

In img tag, we can include alt attribute to display the text when browser is unable to display the appropriate image. Another use of including alt attribute in img tag is, when we keep the mouse pointer on the image, it will display the description of the image.

The two most commonly used image formats are,

Graphic Interchange Format:
In short GIF. It uses 8 bit color representation for each pixels. Hence a single pixel have 256 different colors. This format is mostly used in animation or motion pictures.The file extension for GIF image is filename.gif. It supports transparency. 

Joint Photographic Expert Group:
In short JPEG. It uses 24 bit color representation for each pixels. Hence a single pixel have 16 million different colors. This format is mostly commonly used image format.The file extension forJPEG image is filename.jpg or filename.jpeg. It does not supports transparency. 

Example Program:
Output:


Lesson 8  Previous | Main Page | Next  Lesson 10

No comments:

Post a Comment