There are two approaches we can take to responsive typography:
The media query approach
An intrinsic approach
There isn’t a right or wrong answer, though I do lean toward the intrinsic approach, but both are quite popular.
We’ll start with this approach because it’s a little simpler.
Custom properties can be updated in custom properties, so they make this very easy to do site-wide.
We can use viewport units to create responsive typography.
Never do this .
It seems magical, but there are several problems:
The font will either get way too big on large screens, or too small on small screens.
More importantly, users can’t zoom in or out to adjust the size of the text.
That said, there are ways that we can use them, we simply need to add an extra layer. To do that, we can use a feature we haven’t looked at yet, which is clamp().
It allows us to declare an minimum size, an ideal size, and a maximum size.
.improved-responsive-text {
font-size : clamp ( 1.25 rem , 5 vi , 2.5 rem );
The font wants to be 5vi, but it will never be able to get smaller than 1.25rem, or larger than 2.5rem.
In that middle zone, users still can’t zoom the text in or out though, so we can add a small amount of a fixed size as well.
.better-responsive-text {
font-size : clamp ( 1.25 rem , 5 vi + .5 rem , 2.5 rem );
Doing this for a full range of typography is hard to get right.
Some options:
Use this for large text that has a better chance of causing overflow issues if it stays too big, and use media queries for your smaller text.
Use a generator like Utopia .
Make the project text responsive
You can pick whether you’d like to use a media query or take more of an intrinsic approach using clamp().
I am going to use a media query, changing some of the base font sizes to make them a bit smaller for small screens, then have them go to our current sizes for larger viewports.
Starting Code
If you fell behind or skipped the earlier lessons, you can use this starting code, or the 07-responsive-typography folder from this GitHub repo .
HTML < meta name = " viewport " content = " width=device-width, initial-scale=1.0 " >
< title > Learn Chess the right way </ title >
< link href = " styles/style.css " rel = " stylesheet " >
< header class = " page-header " >
< div class = " page-header-layout " >
< img src = " images/crown.svg " alt = " Frontend Masters Chess Acadamy " >
< nav class = " primary-nav " >
< li >< a href = " index.html " > Home </ a ></ li >
< li >< a href = " instructor.html " > Instructor </ a ></ li >
< li >< a href = " # " > Start Learning </ a ></ li >
< div class = " hero-content " >
< h1 >< span > Books hard to follow? YouTube letting you down? </ span > Learn Chess the right way. </ h1 >
< p class = " lede " > Chess shouldn't feel like memorizing endless opening variations or sifting through amateur
explanations. Our structured approach breaks down complex strategies into clear, progressive steps with
instruction and personalized feedback. < strong > Stop wasting time with scattered resources and start
< button class = " button " > Start learning today! </ button >
< h2 > Start your journey to grandmaster today </ h2 >
< div class = " three-columns " >
< h3 > Learn the Right Way, in the Right Order </ h3 >
< p > Our curriculum follows proven chess pedagogy, building from fundamentals to advanced strategy. Each
naturally to the next, so you always know what to study. </ p >
< h3 > Train with Expert Instructors </ h3 >
< p > Learn from titled players who break down complex concepts into clear insights. Understand not just what
< h3 > Track Your Progress with Precision </ h3 >
< p > Detailed analytics identify your strengths and weaknesses, then adapt your training to focus on what
for your improvement. </ p >
< footer class = " page-footer " >
< div class = " page-footer-content " >
< h2 > Ready to Improve Your Chess? </ h2 >
< p > Join thousands of students who are already leveling up their game. Start your first lesson today—it's free to
started!. < a href = " instructor.html " > Start learning today! </ a ></ p >
CSS src : local ( " Overlock " ), url ( " ../fonts/Overlock-Regular.ttf " );
src : local ( " Overlock Bold " ), url ( " ../fonts/Overlock-Bold.ttf " );
--clr-accent-300 : hsl ( 39 94 % 57 % );
--clr-accent-400 : hsl ( 39 100 % 41 % );
--clr-neutral-100 : hsl ( 0 0 % 100 % );
--clr-neutral-800 : hsl ( 0 0 % 20 % );
--clr-neutral-900 : hsl ( 0 0 % 0 % );
--ff-base : system-ui , sans-serif ;
--ff-accent : Overlock, serif ;
color : var ( --clr-neutral-800 );
font-size : var ( --fs-400 );
font-family : var ( --ff-base );
color : var ( --clr-accent-400 );
font-family : var ( --ff-accent );
font-size : var ( --fs-800 );
color : var ( --clr-neutral-800 );
font-size : var ( --fs-700 );
font-size : var ( --fs-600 );
color : var ( --clr-accent-400 );
text-transform : uppercase ;
background : var ( --clr-accent-300 );
background : var ( --clr-neutral-800 );
color : var ( --clr-accent-300 );
font-size : var ( --fs-500 );
grid-template-columns : repeat ( 3 , 1 fr );
background : var ( --clr-neutral-900 );
justify-content : space-between ;
color : var ( --clr-neutral-100 );
color : var ( --clr-accent-300 );
background-image : url ( ../images/chess-bg.jpg );
background : hsl ( 0 0 % 100 % / 0.8 );
.hero-content > :first-child {
.hero-content > :last-child {
background-image : linear-gradient ( # 444 , # 000 );
color : var ( --clr-neutral-100 );