Lesson 2
Lesson 2
LI: Students will be able to use the <img> tag to add images to their website.
The <img> tag is used to add images to a webpage. It is a self-closing tag, meaning it
doesn't require a closing tag like <p> or <h1>. It has important attributes:
src (source): Specifies the path to the image file. Tells the browser where to find
the image.
alt (alternative text): Describes the image if it can’t be displayed. Provides text for
accessibility or if the image doesn't load.
Task: Create the below html file. Save it as image_example.html
Replace "image.jpg" with the actual file name of an image you want to use (make sure
the image is in the same folder as your HTML file).
Question: What happens if you only change the width or the height?
It looks stretched out an ugly
Question: Why is it important to maintain the correct aspect ratio (proportions) of an
image?
Task: Open the html file you created in the previous lesson and add images of your
hobbies.