Design comparison
SolutionDesign
Solution retrospective
What specific areas of your project would you like help with?
Change font size without using media queries.
Community feedback
- @mkborisPosted 3 months ago
To change font sizes without using media queries you can use the
clamp()
function, it allows you to set a minimum, preferred, and maximum size, making the font size responsive to the viewport.Example :
body { font-size: clamp(1rem, 2vw + 1rem, 2rem); /* Minimum 1rem, ideal size based on viewport, maximum 2rem */ }
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord