HTML TAG
Basic Syntax
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Tag</title>
</head>
<body>
<img src="bg1.jpg" alt="Bg Image">
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Tag</title>
</head>
<body>
<img src="bg1.jpg" alt="Bg Image" width="100" height="100" class="baImage" id="background-Image">
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Tag</title>
</head>
<body>
<img src="bg1.jpg" alt="Bg Image" width="100" height="100" class="baImage" id="background-Image">
<img src="image.jpg" alt="background-Image" width="300" height="200">
<img src="image.jpg" alt="background-Image" title="background Image">
<img src="image.jpg" alt="background-Image" loading="lazy">
<img src="small.jpg" srcset="large.jpg 1024w, medium.jpg 640w" sizes="(max-width: 600px) 480px, 800px" alt="background-Image">
</body>
</html>
Conclusion
- Use alt text so that your website is easier to navigate and improves SEO.
- Use lazy loading so that a single image loads in the user's view, improving page load times.