What is an HTML image?

In HTML, you can add images in a webpage using the <img> tag. The <img> is an empty tag which means it does not have a closing tag. This tag requires some set of attributes to specify the size, alignment, and other properties of an image.

Attributes

Attributes are properties that you want to set for an element. Some of the commonly used attributes for <img> element are mentioned below:

  • src : short for “source”, this attribute specifies the path where the source (image) is located
  • alt : short for “alternate”, this optional attribute is used to specify alternate text in case the image does not appear
  • width : specifies the width of the image
  • height : specifies the height of the image
  • align : specifies the alignment of the image. Possible values could be left, right, center etc. By default, it is set as left.

Syntax

Here’s the syntax to embed an image in an HTML web page:

<img src = "Image_URL/PATH">
HTML <img> tag
HTML <img> tag

Example

Here’s an example that inserts an image at the right with width and height equal to 150px.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved