Design comparison
SolutionDesign
Solution retrospective
What is best practice to achieve the colored overlay on image?
I used background image with linear gradient and the image url. Curious if there is a better solution here?
Community feedback
- @Bayoumi-devPosted over 2 years ago
Hey difool, It looks good!... Here are some suggestions:
All page content should be contained by landmarks
, Contain the attribution with<footer>
.
<footer> <div class="attribution"> //... </div> </footer>
- I suggest you put the status of the preview card component into the
list item
to add moresemantics
to your project,Div
's don't do much for semantics but a list is much more meaningful..:
<ul class="stats-preview__stats"> <li> <span class="stat-number">10K+</span> <span class="stat-name">Companies</span> </li> <li> <span class="stat-number">314</span> <span class="stat-name">Templates</span> </li> <li> <span class="stat-number">12M+</span> <span class="stat-name">Queries</span> </li> </ul>
- This is another way to achieve the colored overlay on the
image
, by by creatingpseudo-elements
containing theimage
and then give the parent elementbackground color
to blend it with theimage
:
.header-image { background-color: var(--violet); min-height: 220px; width: 100%; position:relative; } .header-image::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: url('./images/image-header-mobile.jpg') no-repeat; background-size: cover; mix-blend-mode: multiply; opacity: 75%; }
Hope this help!... Keep coding👍
Marked as helpful0
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