Design comparison
Solution retrospective
I struggled with putting the colour over the image, so looked at how others have done it. Any other ways of doing it would be useful.
Community feedback
- @darryncodesPosted about 3 years ago
Hi Sue,
Another option and some feedback:
- you could try adding a solid
linear-gradient
to a background image:background-image: linear-gradient(hsl(277, 64%, 61%), hsl(277, 64%, 61%) ), url(../your/image-filepath);
rather than creating an overlay per se - explore
background-blend-mode
.multiply
usually does the trick - also you could clear up your accessibility report if you add some alt-texts to your images, try changing
<div class="main-box">
to<main class="main-box">
and<div class="attribution">
to<footer class="attribution">
. Semantic html is really important.
All the best!
Marked as helpful0@Pixie-Code-CreatorPosted about 3 years ago@darryncodes - Great. Thanks for all your advice. Very gratefully received. Sue
0 - you could try adding a solid
- @jenniekibiriPosted about 3 years ago
Normally adding color over an image you use a color overlay, with a CSS property of position absolute.
.image { background-image: url("../images/image-header-desktop.jpg"); background-repeat: no-repeat; background-size: cover; height: 400px; min-width: 50%; position: relative;
} #color-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: hsl(277, 64%, 61%); opacity: 0.6;
}
0@Pixie-Code-CreatorPosted about 3 years ago@jenniekibiri - Thanks Jenny. That is really helpful and a lot simpler than the way I had done it. I will use that next time. Sue
1
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