Stats Preview Card Component using CSS, Flexbox
Design comparison
Solution retrospective
Hello there,
This is my #1 challenge π Is there anything I could optimize in my code? Any feedback is greatly appreciated π Thank you for reviewing my code, I am happy to hear any suggestions! π
Claire
Community feedback
- @correlucasPosted about 2 years ago
πΎHello Claire, congratulations on your solution!
Nice code and nice solution! You did a good job here putting everything together. Iβve some suggestions for you:
To get closer to
overlay effect
on the photo as the Figma Design its better you usemix-blend-mode
. All you need is thediv
under theimage
with thisbackground-color: hsl(277, 64%, 61%);
and applymix-blend-mode: multiply
andopacity: 80%
on theimg
orpicture
selector to activate the overlay blending the image with the color of the div. See the code bellow:img { mix-blend-mode: multiply; opacity: 80%; }
Here's a good article explaining these effects with mix-blend-mode:
https://developer.mozilla.org/en-US/docs/Web/CSS/mix-blend-mode
βοΈ I hope this helps you and happy coding!
Marked as helpful0@ClaireKarsentiPosted about 2 years ago@correlucas Hello Lucas,
Thank you for your feedback π
I just applied your advice for the image and it works perfectly, the code is very clear and readable now for the overlay effect.
Thanks a lot π Claire
0 - @VCaramesPosted about 2 years ago
Hey @ClaireKarsenti, congrats on your first challenge!
Some suggestions to improve you code:
-
The stat numbers are not headings. They should be wrapped in a Paragraph Element.
-
You do not want to have or use empty divs in you HTML code, since this is considered to be bad practice. Instead use the Picture Element
Picture Element will allow your to switch between images in different breakpoints
Syntax:
<picture> <source media="(min-width: )" srcset=""> <img src="" alt=""> </picture>
Source:
https://www.w3schools.com/html/html_images_picture.asp
https://web.dev/learn/design/picture-element/
- To get the image to look like the FEM example, you are going to want to use the Mix-Blend-Mode along with the Multiply Value and include a Opacity with the value of 0.8. (Courtesy of @correlucas)
Code:
img { opacity: 0.8; mix-blend-mode: multiply; }
- Implement a Mobile First approach π± > π₯
With mobile devices being the predominant way that people view websites/content. It is more crucial than ever to ensure that your website/content looks presentable on all mobile devices. To achieve this, you start building your website/content for smaller screen first and then adjust your content for larger screens.
Happy Coding! π»π
Marked as helpful0@ClaireKarsentiPosted about 2 years agoHello @vcarames !
Thank you for your feedback π
I will redo the project by starting building the content for smaller screen first and then adjust it for larger screens. I did like this for my #3 challenge. I also used the Picture Element for my #3 challenge, I guess it's an improvement of my code then ;-)
Thank you for this detailed advice. π Claire
0@ClaireKarsentiPosted about 2 years agoHello @vcarames
I've just updated my code with better practice for the HTML and CSS. Thank you for all your advices, I feel much more confortable with it now π
Claire π¦’
0@VCaramesPosted about 2 years ago@ClaireKarsenti
I am glad I could help! It looks great! Did you add an animation?
0@ClaireKarsentiPosted about 2 years ago@vcarames
Thank you :-)
Yes, I did. I used the Animate.css library for just a little animation at the beginning, nothing "waouh". I would like to train with animation in css, if you have any recommendation with some good ressource to learn about that I'm all ears
0@VCaramesPosted about 2 years ago@ClaireKarsenti
That's a great library! I actually use it myself. I'm still learning animation. The simple ones are easy, but one you get into the more complex one are not so much...
Here's a link that helped me out when I first started studying animation:
https://web.dev/learn/css/animations/
You can use this site, that was created by Google, to learn a lot of things related to web development:
0@ClaireKarsentiPosted about 2 years ago@vcarames
Thank you for your recommendations, seems great, very usefull, thank you !
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