Image source and alt attribute
📖 Scenario: You are creating a simple webpage to display a picture of a cute puppy. This webpage will help visitors see the image and understand what it shows even if the image cannot load.
🎯 Goal: Build a basic HTML page that shows an image of a puppy using the correct src and alt attributes in the <img> tag.
📋 What You'll Learn
Use a valid HTML5 document structure with
<!DOCTYPE html>, <html>, <head>, and <body> tags.Add an
<img> tag with the exact src attribute set to 'puppy.jpg'.Add an
alt attribute to the <img> tag with the text 'Cute puppy sitting on grass'.Make sure the HTML is valid and the image displays correctly in a browser.
💡 Why This Matters
🌍 Real World
Websites use images to make content engaging and informative. Using the <code>alt</code> attribute helps people who use screen readers and improves SEO.
💼 Career
Knowing how to properly add images with descriptive alt text is a fundamental skill for web developers and content creators to build accessible and user-friendly websites.
Progress0 / 4 steps