HTML Images

HTML has <img> tag to display image on the web pages or web application. This tag is an empty tag i.e. we don't have to close this tag while using. SYNTAX:

<img src="source address" attributes="alt, height, width">
<center>Image tag Example</center>  
<img src=""   
Output: Image tag Example
HTML Images - TutorialAndExample

Attributes of Image tag

  • src: It is the most important attribute of image tag which allows to describe the source or path of the image. Source attributes instruct the browser where to look for the image source. Image source can be on same directory or server which can be local or global.
  • alt: It stands for alternate text which describe the information about the image but text is visible only when image is not loaded due to any type of error.
  • Height: This attributes allows the user to decide the height of the image. Value provided to this attribute is either in "Pixel" or "Percentage".
  • Width: It allows programmer to fix the width of image. Value provided is similar to the Height attribute.