About Lesson
Definition:
In HTML (Hypertext Markup Language), images are included in web pages using the <img>
(image) element. The <img>
element is a self-closing tag, meaning it doesn’t have a closing tag. It is used to embed images into a webpage by specifying the source (URL or file path) of the image.
- Tag:
- <img> – The
<img>
tag is an HTML element used to embed images in a web page. It stands for “image.” The<img>
tag is a self-closing tag, meaning it doesn’t have a closing tag. Instead, it includes attributes that provide information about the image, such as its source and alternate text.
- <img> – The
- Attributes:
- src – The
src
attribute specifies the source (URL or file path) of the image. - alt – The
alt
attribute provides alternative text for the image. This text is displayed if the image cannot be loaded and is also used by screen readers for accessibility.
- src – The
Syntax:
<img src=...source of image..." alt="......"/>
Example:
HTML
<!DOCTYPE html>
<html>
<head>
<title>Html Images</title>
</head>
<body>
<h1>HTML Images</h1>
<img src="/flip-card/logo.png"/>
</body>
</html>