Lesson 11: HTML Images

Displaying Web Images

The <img> tag embeds images into a webpage. It is an empty element (contains no closing tag) and requires src and alt attributes.

<img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">

Why&How to use:

Images make web pages visually engaging. The alt attribute provides alternative text for accessibility and whenever images fail to load.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Images</title>
</head>
<body>
<h1>Image Display Example</h1>
<img src="https://via.placeholder.com/150" alt="Sample Placeholder" width="150" height="150">
</body>
</html>