Articles → HTML → Img Tag In HTML

Img Tag In HTML






Syntax


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




  1. Src – specifies the image source. In the src attribute, you can specify the local path as well as URI.
  2. Alt – Tooltip of the image

Sample


<html><head><title>Image Demo</title></head><body><img
      src="http://www.gyansangrah.com/ArticleImages/anchor_tag_html_one.jpg"
      alt="Sample tooltip"
    /></body></html>




Picture showing the output of img tag in HTML with tooltip

Click to Enlarge



Picture showing the tooltip text shown when image path does not exists

Click to Enlarge


Setting Up The Width And Height Of The Image






<html><head><title>Image Demo</title></head><body><img
      src="http://www.gyansangrah.com/ArticleImages/anchor_tag_html_one.jpg"
      alt="Sample tooltip"
      width="200"
      height="200"
    /></body></html>






Picture showing setting the width and height of the image in HTML

Click to Enlarge




Browser Support


Internet ExplorerFirefoxChromeSafariOperaEdge
YesYesYesYesYesYes



Posted By  -  Karan Gupta
 
Posted On  -  Saturday, January 2, 2016
 
Updated On  -  Monday, June 5, 2017

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250