Stats preview card using flexbox

Solution retrospective
Please have a look at my solution and leave some feedback.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @correlucas
👾Hello Dario, congratulations for your new solution!
Dario I saw your code and it's working but is a bit long, you don't need a class for each element you can use the direct selector for some. I've two other suggestions for you.
To apply the color instead of use this long code
.card__picture{ width: 100%; height: 240px; background-image:linear-gradient(to right, hsla(277, 64%, 30%, 0.6), hsla(277, 64%, 30%, 0.6)), url(images/image-header-mobile.jpg); background-size: 100% 100%; background-repeat: no-repeat; }
To make your hero image have the same look and the color purple overlay, you need to use
mix-blend-mode
using themultiply
one.The mix-blend-mode CSS property sets how an element's content should blend with the content of the element's parent and the element's background.Here’s how you can add this to your
img
selector:img { mix-blend-mode: multiply; opacity: 84%;}
A shortcut to deal with the multiple images in this challenge is by using the
<picture>
tag instead of importing this as an<img>
or using a div withbackground-image
. Use this tag to make the image change between mobile and desktop is to use<picture>
instead of<img>
wrapped in a div. Look that for SEO and search engine reasons isn’t a better practice import this product image with CSS since this will make harder to the image be found. You can manage both images inside the<picture>
tag and use the html to code to set when the images should change setting the devicemax-width
depending of the device (phone / computer) Here’s a guide about how to usepicture
:https://www.w3schools.com/tags/tag_picture.asp
✌️ I hope this helps you and happy coding!
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