Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Stats preview card component

P
Jax Teller 670

@piushbhandari

Desktop design screenshot for the Stats preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


how do i do responsive imgs when i'm using background-image? i couldn't figure it out so i just had to do <img/> instead and thus the weird overlay color.

sure it worked with absolute units, but the background-image wouldn't show up if i used max-width or percents.

Community feedback

Elaine 11,400

@elaineleung

Posted

Hi Jax, could you use background-size: cover with width and height set to 100% and then set the responsive width and height that you want in a parent container (as in, the div with the background image would be contained within an image container)?

You can also try a picture element instead of background image, since you can include images of different sizes along with the media query you want them shown at:

<picture>
    <source media="(min-width: 960px)" srcset="image-desktop.png" />
    <img src="image-mobile.png" alt="perfume bottle" />
</picture>

Hope this helps!

Marked as helpful

2
Lucas 👾 104,420

@correlucas

Posted

Hello Jax, congratulations for you new solution.

I agree with 100% of the things my friend Elaine said. In addition you can also match the exact overlay effect for this challenge using mix-blend-mode.

Here's how, see the code below:

Img {
Mix-blend-mode:multiply;
Opacity: .8;
}

If you want too boost the page loading you can use the tool called minify to reduce the css sheet, there's also a plugin im VScode thst does this work.

Hope it helps, happy coding. 👏

Marked as helpful

1

Please log in to post a comment

Log in with GitHub
Discord logo

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