how add image to web page

the <img> tag is used insert image into html document. <img> tag has no closing tag.as such,you should include the slash at the end of the tag<img/>. every img element takes minimum four attributes src, alt, width, height.

html image tags attributes

<img> attributeattribute valuedescription
src(url path) in absolute or relative formatsrc value hold the image file location
alttext informationalt value provide alternative information for the image
widthpx, % hold the image width
heightpx, %hold the image height

image - syntax for defining an image:-

   <img  src ="url path"  alt="text value" 
     
         width = "number px value" height = "number px value"/>

html - image file formats:-

image file support three graphics files formats:gif ,jpeg,png.

  • gif :-("http://www.w3.org/images/rose.gif");
  • jpeg :-joint photographic experts group ("http:/images/rose.gpeg")
  • png :-portable network graphics ("/images/rose.png")

html image example:-

  <html>
      
       <head>  </head>
       
       <body>
       
  <img  src="/images/img.jpg" width="100px" height="100px" alt="this is photo"  />
       
  <img  src="./images/img.png" width="200px"height="200px" alt="images show" />
       
      </body>
      
       </html>