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

Stat Card solution with entry level flex / html / css

Michael 35

@Mekes1670

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


Hi! I struggled a lot with this one and I was really looking for advice in a couple of things. I couldn't figure out how to tint the picture even when I tried setting it as a background image, my one guess was maybe a transparent div but I would love more info.

Also the issue when going into mobile view is that I had to resort to displaying the image as block and it wouldn't resize without the picture overflowing. When I specified height / width it just became small. I would love some tips regarding this.

Last but not least I was set on displaying the stats as h2 / h3 but I figured with semantic HTML that would not be appropriate, so I went with a table design instead, would that be more appropriate? I couldn't figure out how to get it to look the way it did in mobile in regards to the "stats" section, any advice would be greatly appreciated.

Thank you so much for your time and as always, any help or anything I could improve here I would love to know.

Community feedback

@pikapikamart

Posted

Hey, great work on this one. The layout in desktop is good, though it is smaller than the original, the mobile layout is good as well, but I think making it a bit more stretch will be good, sorry nitpicking on those.

Some suggestions would be:

  1. Adding a padding to the top and bottom of the body tag, just to make some spacing to prevent touching both ceiling and flooring.

  2. To achieve that purple or what color is that, hmm. To achieve that, simply add background-blend-mode: multiply; on the rightCard selector, that blends the background-image and the color. Then after that, you will see the color changes, then just tweak the background-color to achieve what you want.

  3. Lastly, removing the margin-left: 20px on the card selector in mobile state will be good to make it centered properly. Also making the body have more width, like 90% instead of 80%. Since it is mobile state right.

Regarding your concern:

  • On the image part, I don't see any img tags being used in here so I can't really help you that much on it. Though there are commented img tags, is that what you are referring to? But still, can't tweak if it is commented.

  • On the table part, well I think you are right not to use header tags on those since it doesn't really adds up to be heading as well. Also using that table element, it's rare for me to see one of those so really good job on that! Making it work really good, that's awesome. I rarely used it since there are too many, making table datas, table heading and it annoys me :>

Overall, really great job on this^^

1

Michael 35

@Mekes1670

Posted

@pikamart Hey! Thanks so much for such a detailed reply, nitpicky or not I really appreciate it. The "background blend color" was what I tried but I must have messed it up. I'll give it a second look! I'll make sure I try that out again. I've been trying to use margin but I should really consider looking into padding for spacing on the body, I keep compensating for that by adding too much margin to other things so I'll keep that in mind for next time!

In regards to the images, I had a lot of issues with the images breaking and resizing improperly during the desktop -> mobile view so I ended up trying and making the .rightCard a background image instead of an actual image and I liked that more. But when I collapsed it and went mobile it got rid of the background image altogether and I couldn't figure it out so I ended up just adding the mobile image back and having it display:none until the media query hit and then I just used the mobile image with display: block. This part I had more issues than I thought I would with it.

Thanks so much for taking some time and looking, you cleared up a lot of my issues. :)

0

@Tmajor97

Posted

to tint the picture use overlay in css

.container .picture .overlay{ background-color:rgba(99, 23, 147, 0.8); height:400px; }

1

Michael 35

@Mekes1670

Posted

@Tmajor97 Hey thanks for the reply! So I would make a separate div over the image itself and then set class to "overlay" and then add a background color through that? Just so I'm understanding correctly.

0

@Tmajor97

Posted

yes make a div with class picture and inside it make another div with class overlay and set a background-colour through it.....check work and GitHub for more details https://github.com/Tmajor97/stats-preview-card-component..

https://www.frontendmentor.io/solutions/mobile-first-stats-preview-component-ow5x36jAA

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