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

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.