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

HTML CSS Flexbox

Gavin Loo 100

@rawsashimi1604

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


Hey guys, I am unable to make the image purple. I have tried using background: and filter: Could anyone help me with this?

Community feedback

Jeuri Morel 1,405

@JeuriMorel

Posted

One thing you can try is by using a pseudo-element. Add position: relative; to the div that contains the image, then add this CSS:

.image::before {
    content: '';
    inset: 0;
    position: absolute;
    background-color: purple;
    opacity: 0.5;
}

Change the background color to the color you wish to use and play around with the opacity. Don't know if this is the best solution, but it's the first thing I would try. Hope this helps.

Marked as helpful

2

Gavin Loo 100

@rawsashimi1604

Posted

@JeuriMorel Hey Jeuri, your solution helped! Thank you

0

@ADITHYAADHI06

Posted

use div , b-image and b-color and then use background-blend-mode as soft-light.... in this one of way to do that

Marked as helpful

2

Gavin Loo 100

@rawsashimi1604

Posted

@ADITHYAADHI06 Hey Adithya, I used opacity: 50%; to solve the issue. Will take a look at your solution when I have the time to do so!

0

@kelvin-lee098

Posted

Hey Gavin, Let's try set your image in backgroud-image. Then, you should add a div inside, and css for that div maybe is: { height: 100%; background-color: rgb(98 9 154); opacity: 0.5; }

Marked as helpful

1

Gavin Loo 100

@rawsashimi1604

Posted

@kelvin-lee098 Thank you Kelvin, that helped me solve the issue!

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