Responsive Stats Preview Card using pure HTML and CSS
Design comparison
Solution retrospective
Hello everyone, how can I add the light violet color to the image present in the website, I'm not able to figure out. Please help
Community feedback
- @NikitossikPosted over 1 year ago
Hey, you can create an overlap by using pseudo elements. You have to wrap an
img
tag withdiv.someClassName
and addposition: relative
. Then add::before
or::after
to this element and give itposition: absolute
so it could move inside of it, aplly background, width, height and don't forget aboutz-index
to make it above the image.Also there is an approach with backgrounds with background-blend-mode
good luck)
0 - @Clive-ChambersPosted over 1 year ago
I did something like this to make the image have a purple overlay effect. Let me know if this helps :)
<div class="office-img"> <picture> <source media="(min-width: 415px)" srcset="./images/image-header-desktop.jpg"> <img src="./images/image-header-mobile.jpg" alt="A picture of three women in an office"> </picture> </div>
.office-img { display: inherit; position: relative; max-height: 289px; background-color: hsl(277, 64%, 61%); } img{ width: 100%; height: 100%; position: relative; background-size: cover; mix-blend-mode: multiply; opacity: 0.75; }
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