HTML/CSS Stats card component

Solution retrospective
Hello ! Second challenge completed, I did this one faster than the first one (the product card), but I encountered more difficulties, especially on the responsive.
Several questions come to mind:
-
I have centered my card, setting my #main to 100vh, display: flex, justify-content: center and align-items: center. Is this the right solution (line 20 in my css file)?
-
I don't know if I've used the em units correctly for the font sizes, do you have any suggestions for this?
Thank you in advance for your precious advice!
Please log in to post a comment
Log in with GitHubCommunity feedback
- @correlucas
👾Hello @Loic2A, congratulations for your new solution!
I saw your solution preview site and I think it's already really good. Here’s some tips for you to improve it:
You can use this code shortcut to reach the same color of the challenge. All you need is to use
mix-blend-mode
to make the color blend between the image and the background-color of the container. See the steps below to apply to theimg
orpicture
selector:img { mix-blend-mode: multiply; Opacity
Don’t use
id
to give the style of your elements, it's not a good idea becauseid
is a too specific selector used forforms
and Javascript code. Instead, useclass
for styling and let theid
for much specific stuff. It's also not advisable to use IDs as CSS selectors because if another element in the page uses the same/similar style, you would have to write the same CSS again. Even if you don't have more than one element with that style right now, it might come later.✌️ I hope this helps you and happy coding!
Marked as helpful - @jvmdo
Hi, LOÏC2A. I'm learning the basics as well, but I think I help with your questions.
According to this MDN cookbook your centering technique is correct.
The font size is hard to guess by looking, but the styles guide provides the paragraph font (15px), then you guess the heading are bit greater.
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