Mobile-first solution using BEM, Flexbox, and SCSS
Design comparison
Solution retrospective
I had some trouble when it came to changing the image color from black and white to the purple used in the design.
I'm aware of the filter
property that can be used on images, but I'm not sure how to use it to apply a purple filter. Does anyone know how to do that, or should I just add the filter using some photo editing software?
Also, while making the mobile version, I felt like making it without up/down scrolling would've resulted in really small fonts, so I kept the larger font with some scrolling.
Did anyone else follow a similar approach?
Community feedback
- @darryncodesPosted about 3 years ago
Hi Victor,
Good solution - well done!
- 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);
this would help get you closer to the purple colour overlay in the design rather than creating an overlay in the mark up - also explore
background-blend-mode
All the best!!
Marked as helpful2 - you could try adding a solid
- @marcolepdevPosted about 3 years ago
To color the right image in violet, apart from using both the
background-color
and thebackground-image
, use theblend-mode
. I tried different ones andmultiply
seemed to do the work quite well.Marked as helpful1 - @Victor-NyagudiPosted about 3 years ago
Thank you guys for all the helpful feedback!
I ended up using a
background-color
, abackground-image
, andbackground-blend-mode
to get the result I wanted.I've updated my GitHub repo, but I don't see the changes over here, so I guess I'll have to restart the challenge.
Cheers!
0@Victor-NyagudiPosted about 3 years ago@Victor-Nyagudi I've updated my solution to the latest version that's built using SCSS.
0 - @MoodyJWPosted about 3 years ago
Hey there! I was having a similar issue on this challenge and never quite figured it out until I was working on something else more recently.
.container { width: 100vw; height: 100vh; background-color: rgba(255, 255, 255, 1); }
Above code sets the background color (obvi use your own values here), the 4th rbga value is the opacity.
.container::before { content: ""; background-image: url(your/file/here); background-size: cover; background-repeat: no-repeat; position: absolute; top: 0px; right: 0px; bottom: 0px; left: 0px; opacity: 0.1; }
Above code uses the pseudo-element ::before, which allows you to place the image with an opacity. Other props are for centering and covering the containing element with the image (change as needed).
.container > * { position: relative; }
Above will apply a relative position to everything below the
container
, without this other elements would also have the color filter.I tried working with a
linear-gradient
and/orblend-mode
, but had little success (I was probably just doing it wrong) and this worked well for me on my other project.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