HTML Images

HTML Tutorial

HTML Forms

HTML Graphics

HTML Media

HTML API

HTML Images

HTML Image Syntax

  • The HTML <img> tag embeds the image in a web page.
  • Technically images are not inserted into a web page; images are linked to web pages. The <img> tag defines a holding space for the referenced image.
  • The <img> tag is empty, consisting of attributes only, and does not have a closing tag.
  • The <img> tag has two required attributes:
  • src – Specifies the path to the image
  • alt – Specifies an alternate text for the image

Syntax

<img src=”url” alt=”alternatetext”>

				
					<!DOCTYPE html>
<html>
<body>
<h2>HTML Image</h2>
<img fetchpriority="high" decoding="async" src="img_mountain.jpg" alt="mountain" width="600" height="400">
</body>
</html>


				
			

Output:

HTML Image

mountain