Stats preview card component - newbie challenge #1
Design comparison
Solution retrospective
How do I add the purple tint to the image?
Community feedback
- @vanzasetiaPosted over 3 years ago
👋Hi Rohit! My name is Vanza.
To add the purple tint, you can wrap the
img
tag with onediv
then in your CSS, you can dodiv { position: relative; } /* Create an overlay */ div::after { content: ""; position: absolute; top: 0; left: 0; height: 100%; width: 100%; background-color: hsla(277, 64%, 61%, 0.5); }
Or the second way to do it (which is the best way), is that first create a div under the
container
and set the image as abackground-image
and then addbackground-color: hsl(277, 64%, 61%)
, lastly you can dobackground-blend-mode: multiply
.That's it! Hopefully this will solve your problem!
1@rrgmonPosted over 3 years ago@vanzasetia Hey! Thank you for this solution! I was trying the pseudo class method, but seems like I was doing it wrong since I tried it straight for the IMG tag. 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