Slide 1
Slide 2
Slide 3

Insert image in HTML5 (HTML-V39)

No Comments

10. Images

Images provide visual content for web pages, which helps improve the user experience and present information clearly. They can be photographs, graphics, icons, or illustrations.

HTML provides various elements for embedding, manipulating, and controlling images, which help enhance the aesthetics and functionality of a website. Understanding image tags, attributes, and responsive design principles is important for effective web development.


 Syntax:

<img src="image_path" alt="Alternate text for the image" width="200px" height="150px" />

  • src: The src attribute sets the path (URL) of the image.
  • alt: The alt attribute sets the alternative text. If the image link is broken, the alternative text is shown on the web page instead.
  • width and height: The width and height attributes set the width and height of the image.

10.1. Insert Images

You can embed an image into a web page using the <img> tag with the src attribute, which is the required attribute for setting the image path.

Note: The <img> tag is an empty tag, which means it contains only a list of attributes and has no closing tag.

Source Code:

Copied!
<!DOCTYPE html>
<html>
<head>
    <title>Image Example</title>
</head>
<body>

    <h2>Example Image</h2>

    <!-- Insert Image -->
    <img src="images/logo/Kru_IT.png" alt="Kru_IT logo" width="200" height="150">

</body>
</html>

Result: 

Watch the video:


Ebook:
https://softkhpc.blogspot.com/2026/11/html-tutorial-beginners.html

back to top