Good Code
The good version uses clamp() to set responsive bounds and keeps body text at a readable base size.
Lesson 05
Use responsive ranges that respect readable text and container context.
.lesson-card {
/* Bounded values scale with the component without losing readability. */
container-type: inline-size;
padding: clamp(1rem, 2cqi, 1.5rem);
max-width: 42rem;
}
.lesson-card__title {
font-size: clamp(1.25rem, 1rem + 1vw, 2rem);
line-height: 1.2;
}
.lesson-card__body {
font-size: 1rem;
line-height: 1.6;
}body {
/* Viewport text size can become unreadable outside this exact screen width. */
font-size: 1.2vw;
}
.lesson-card {
padding: 4vw;
}
.lesson-card__title {
font-size: 4vw;
}The good version uses clamp() to set responsive bounds and keeps body text at a readable base size.
The bad version renders responsively, but viewport-scaled body text can become tiny on narrow layouts or oversized on wide screens regardless of the content container.