Design comparison
Solution retrospective
Hello Everyone,
Here is my attempt at the responsive stats card exercise. I am sure there is a lot to improve here, particularly in the style files. I think it could be done in plain CSS with fewer lines of code. Any suggestions would be welcome. Thanks.
A couple of questions:
- What units you recommend for
margin
,padding
,font-size
, for such a project. - For this project, is it better to use
background-image
CSS property or<img>
element in HTML?
Community feedback
- @asab07Posted over 3 years ago
Thanks for your response, Vanza. It appears that rem units are more predictable than em units.
0 - @vanzasetiaPosted over 3 years ago
👋 Hi Adeel! My name is Vanza!
I am going to answer your questions:
- I recommend to use
rem
units in any projects, sincerem
can let the user change theirfont-size
. If you're usingpx
, the user can't see any difference, which mean they can't control theirfont-size
, based on their setting. Forem
, in some cases you can use it forpadding
andmargin
. - I would argue, that using
background-image
is much better. The reason for that is because, it much easier to create purple effect just by doing this:
.card__image { background-image: url('../images/image-header-mobile.jpg'); background-repeat: no-repeat; background-size: cover; background-color: #aa5cdb; background-blend-mode: multiply; height: 14rem; }
And then you can change the image into desktop version by adding media query. (also you can remove the
img
tag inside thecard__image
).That's it! Hopefully these answers your questions!
0 - I recommend to use
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