HTML IMAGES
HTML Images: Adding Visuals to Your Web Pages
What is the <img> Tag?
The <img> tag is used to embed images in your web pages. It is a self-closing tag and requires attributes to specify the image source and alternative text.
Using the <img> Tag
The two most important attributes for the <img> tag are:
- src: Specifies the path to the image file. Example:
<img src="image.jpg">
- alt: Provides alternative text for the image, which is important for accessibility and SEO. Example:
<img src="image.jpg" alt="Description">
Example: Adding an Image
Here’s an example of how to include an image in an HTML document:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Images Example</title>
</head>
<body>
<img src="example.jpg" alt="Example Image" width="600">
</body>
</html>
No comments