Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

That wasn't hard until give color to image was really difficult

#accessibility
ata58011β€’ 220

@ata58011

Desktop design screenshot for the Stats preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Guys how can i give a color to img using html tag in my project i gived to img with content property

Community feedback

@KristinaRadosavljevic

Posted

Hi there, congrats on completing the challenge :)

As for coloring the image, there's a CSS property called background, you can assign it to a color, image, gradient, etc. And also, this property can have multiple values, where the values will stack on top of each other. You can use this functionality to very easily add a tint to the image by overlaying it with a semi-transparent linear-gradient (I used this article to help me figure it out, and you can also check out my solution to see how I implemented it).

There are a couple of other little things I noticed while checking out your solution:

  • I don't think you should use this many <br> elements in your HTML. I believe the text is supposed to break naturally when using the correct layout.
  • Instead of using .stats ul li:nth-child(1) as a selector, I would personally give these elements a class name, I figure it would make the CSS code a bit cleaner (although, I guess this can be used to practice pseudo-classes, so if that was the intention, you can ignore this point) :)
  • You can work on making your project a bit more responsive by using things like rem units (or some other responsive units), max-width, media queries, etc.

I hope this helps! :)

Marked as helpful

0
Lucas πŸ‘Ύβ€’ 104,580

@correlucas

Posted

πŸ‘ΎHello @ata58011, congratulations on your solution!

Nice code and nice solution! You did a good job here putting everything together. I’ve some suggestions for you:

To get closer to overlay effect on the photo as the Figma Design its better you use mix-blend-mode. All you need is the div under the image with this background-color: hsl(277, 64%, 61%); and apply mix-blend-mode: multiply and opacity: 80% on the img or picture selector to activate the overlay blending the image with the color of the div. See the code bellow:

img {
mix-blend-mode: multiply;
opacity: 80%;
}

✌️ I hope this helps you and happy coding!

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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