Responsive Stat Preview card with CSS Flexbox
Design comparison
Solution retrospective
How did they manage to get the greyscale photo into that purple color? Could I have made it for responsive with flexbox or do I need to look at CSS grid? Could I have used semantic html more?
Community feedback
- @ixtkPosted over 3 years ago
There's no need to use grid here, you can make this particular component fully responsive with only flexbox.
Few problems:
- There's horizontal scrollbar on desktop layout
- Component cuts off (top side) on mobile layout
- You also needed to apply
border-radius
to the component
Suggestions:
- I would avoid setting fixed width and height with
vw
andvh
units. Instead let the content grow or shrink the component and set margin for the sides on the parent elements. Maybe setmax-width
- I would use
section
HTML tag for this component - I would remove default
margin
frombody
Regarding purple background color:
You could have added a separate
div
with purple background color, then usedposition
property to position it on top of the image and give it little bit of opacity.Easier approach would be to use
background-blend-mode
property. Check that outPS: Check the website report
0
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