Design comparison
Solution retrospective
I kind of cheesed the styling of the image by using two divs - one with a blended background image and colour, and then one on top of that with some transparency. Is there a better way of getting the same effect?
Community feedback
- @vanzasetiaPosted over 2 years ago
Hi there! 👋
I would recommend putting the image as an actual
img
element on the HTML because theimg
would have height by default. So, you don't need to specify aheight
. Also, you can usepicture
element to change the image from one version to another.Also, I suggest making the
img
as block element and settingmax-width: 100%
to make it easier to work withimg
element.Then, to create the overlay I suggest using
mix-blend-mode
and adjusting theopacity
of theimg
to make it looks similar (or even the exact same) to the design.For your reference, you can see @DarrickFauvel's solution for this challenge. He had done an amazing job on making the overall (and the site overall).
One suggestion - I recommend making the
stats
as a list. If the site has no styling (which is like a document) then it would be a list. This way, the statistic has semantic HTML markup. 😉`- 10k+ companies
- 314 templates
- 12m+ queries
Lastly, don't forget to fix all the issues that have been generated.
That's it! I hope this helps. 🙂
Marked as helpful2 - @Opeoluwa-OgunlajaPosted over 2 years ago
Hey King!
For the image, you can use a pseudo element to achieve the same result like
::after
or::before
- just add some CSS to the
.header-img
;
.header-img{ ............................ position: relative; isolation: isolate; }
- Then you should be able to style the pseudo element to look like;
.header-img::before{ position: absolute; inset: 0; mix-blend-mode: overlay; background-color: .....; }
Not sure if it's a better way to you though but I hope you found it helpful 🙂
Marked as helpful1 - just add some CSS to the
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