Marigold
0 to Infinity HTML Lesson
Images make a web page visual, emotional, and understandable. In this lesson, we start from the simplest image tag and go up to responsive images, captions, lazy loading, accessibility, and Search Engine Optimization.
By the end of this page, you will understand how to place images correctly, how to describe them, how to size them, how to make them responsive, and how to avoid common mistakes.
Before writing the tag, know where the image is saved.
html-img-0-to-infinity/
├── index.html
└── pics/
├── marigold.png
├── lotus.png
├── hibiscus.png
└── jasmine.png
The simplest useful image uses src and alt.

<img src="pics/marigold.png" alt="A bright marigold flower illustration with green leaves">
If the image cannot load, the browser can show the alternate text. Screen readers also use it to explain the image to users who cannot see it clearly.
Do not let images break your layout.
This block stays readable while the image adapts to available space.
img {
max-width: 100%;
height: auto;
display: block;
}
.flower-photo {
border-radius: 18px;
border: 1px solid #efdfb2;
}
Add real width and height attributes when possible. They help the browser reserve space before the image loads.
Now use several images in a clean grid.
Marigold
Lotus
Hibiscus
Jasmine
<div class="flower-grid">
<article class="flower-card">
<img src="pics/marigold.png" alt="Marigold flower">
<p>Marigold</p>
</article>
<article class="flower-card">
<img src="pics/lotus.png" alt="Lotus flower">
<p>Lotus</p>
</article>
</div>
.flower-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
}
Make mixed image sizes look consistent.
Wide card
Equal height
Clean gallery
.flower-card img {
width: 100%;
height: 180px;
object-fit: cover;
}
Do not stretch an image by forcing both width and height without object-fit. It can make people, products, and diagrams look distorted.
Now move toward professional usage.
Use figure when the image and its caption form one meaningful unit, such as a diagram, chart, gallery photo, or teaching illustration.
Use lazy loading for images that are lower on the page. The browser may delay them until the user scrolls near them.
<figure>
<img
src="pics/jasmine.png"
alt="A jasmine flower illustration"
width="900"
height="600"
loading="lazy"
>
<figcaption>Jasmine flower example with a visible caption.</figcaption>
</figure>
<img
src="pics/marigold.png"
srcset="pics/marigold.png 900w, pics/lotus.png 900w"
sizes="(max-width: 700px) 100vw, 50vw"
alt="Flower example for responsive image learning"
>
<picture>
<source media="(max-width: 700px)" srcset="pics/lotus.png">
<img src="pics/marigold.png" alt="A flower selected by the browser">
</picture>
Improve this flower image lesson yourself.
Add a new image file and copy one article.flower-card block. Change the src, alt, and caption text.
Use overflow:hidden on the card and transform:scale(1.05) on the image during hover.
Use a source tag for the mobile image and keep a normal img fallback.
The img tag looks small, but it opens a large subject: paths, accessibility, performance, responsive design, captions, and Search Engine Optimization.
Turn this into a real flower encyclopedia page. Add flower names, seasons, uses, location, and a larger image gallery.