Home » Web programming/HTML

HTML 'img' Tag with Examples

HTML | <img> Tag: In this tutorial, we are going to learn about the Emphasized (<img>) tag in HTML with its description, syntax, and examples.
Submitted by Shivang Yadav, on February 21, 2020

<img> Tag

<img> tag in HTML is used to add images to an HTML page. In needs two attributes to function properly,

  • src: the src attribute is used to add the location of the image file.
  • alt: the alt attribute in HTML is used to define an alternate text which is display when the image is unable to load.

Syntax:

<img src="locationOfImage" alt="alternate-text">

Technical insights of <img> tag

  • It supports global attributes and attributes that handle events of HTML5.
  • Supported by all browsers.

Example:

<!DOCTYPE html>

<html>

<head>
    <title>HTML Tutorial at IncludeHelp</title>
</head>

<body>
    <h1>Img Tag Example...</h1>
	<img src="img_forest-1.jpg" alt="Forest Image">
	<br>	
</body>

</html>

Output

HTML | img Tag

Read more about adding images to HTML – Images in HTML.



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.