Responsive blog card using flexbox and CSS clamp() property
Design comparison
Solution retrospective
First time using this css property. The challenge asked for a responsive font-size without using media queries. Found this property to be the most suitable after doing some research. Still trying to understand how it works.
I am going to work more on responsiveness with media queries and properties like clamp.
I will also dive a bit more into Figma to understand how to better use it and get the most out of the figma files.
What challenges did you encounter, and how did you overcome them?I struggled first with what was asked concerning font-size responsiveness. I did some research and found an article about the CSS clamp() property.
What specific areas of your project would you like help with?The main aspect that could be of a problem is the beginning of a project. Should I use semantic html? Should I wrap every element into div containers?
Community feedback
- @Alex-Archer-IPosted 5 months ago
Hi!
The short answers for your questions are yes and no =)
Yes, you should use semantic tag. At first it's a
main
tag - it could be.card
element in your case. Than you could replace all thespan
withp
(actually "Learning" thing looks like the link, but this project is out of context, so never mind =)).And no, you shouldn't wrap every element to
div
, it's just create more unnecessary tags. Your layout is quite good now =)The
clamp()
function takes three parameters. The first and last are defines the minimum and maximum of the value. And the middle one is relative value which would change within that range. In your case the font size will be1.1vw
(which means 1,1% from width of the screen) but would never be smaller than12px
and larger than14px
.And responsive tips. Try not to hardcore
width
for text elements (I mean.tag-learning
and.date
) andheight
for the container element. In real project the content could change time to time, so it's better if the space would adjusting to it.Hope that could help. Good luck in your frontend journey and fell free to ask anything if need =)
Marked as helpful1@Arnotts33Posted 5 months agoHi @Alex-Archer-I !
Thanks for the very helpful and thorough feedback.
1
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