Responsive Blog Preview Card (Flex, custom properties, media queries)

Solution retrospective
I would really like to know some ways how to use different font sizes on desktop and mobile without using media queries, thank you
Please log in to post a comment
Log in with GitHubCommunity feedback
- @Blackpachamame
Hey your solution is amazing! 🤩
📌 Some suggestions
- You can apply
display: block
to the image to remove the white space generated underneath. Although visually in this case it is irrelevant, it helps you better calculate the space with other elements - The
Learning
tag could be aspan
instead of adiv
- The
Published 21 Dec 2023
text should be ap
instead of adiv
. Thetime
thing is fine
Marked as helpful - You can apply
- @YacoubDweik
Good job with using semantic elements!
To change font-size without media queries you can use something like this, but sometimes you need to play with values:
font-size: clamp(20px ,5vw + 1rem, 30px)
Marked as helpful - @eLAmaravati
You can use CSS clamp(), min(), or max() functions. Example:
font-size: clamp(1rem, 2vw, 2rem);
This scales the font between 1rem and 2rem based on viewport width, without media queries.
Marked as helpful
Join 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