Responsive Stats Preview Card Component Using CSS Grid
Design comparison
Solution retrospective
Hey guys, here is my 4th frontendmentor project. I am enjoying the journey. Please take a look at my solution. Where i am using two separate image tags for mobile and desktop view. And showing corresponding image based of the screen width. is that the right way to do it ? Or any better solution? your feedback is important. Thank you.
Community feedback
- @MinhKhangTranPosted over 2 years ago
Hi Shamil Ussain C, nice solution!
If you want to use responsive images you can use
picture
andsource
with srcset tags in your html.For example:
<picture> <source media="(max-width: 1029px)" srcset="./images/image-header-mobile.jpg"> <source media="(min-width: 1030px)" srcset="./images/image-header-desktop.jpg"> <img src="./images/image-header-desktop.jpg" alt="image-header"> </picture>
I found a helpful article at mdn. If you are interested you can read there more.
I hope this helps. Keep going and have fun 🥰.
Marked as helpful0@shamilussaincPosted over 2 years agohey @MinhKhangTran , I have read the article and it found really useful. thank you for sharing it with me and thank you for your feedback.
happy learning 😊
0 - @tea-scriptsPosted over 2 years ago
Great job completing the challenge. Just some points:
- Nesting is one of the beautiful features of SASS but try as much as possible not to always nest too deep. Might become hard to find things.
- Also try not to nest in the
body
. Keep only default styles in thebody
. Default styles likeline-height
, defaultcolor
, defaultfont-family
etc. should be the styles in yourbody
then you can overwrite them later outside of the body wherever you'd need to. - You might also want to consider using sematic HTML like
article
in place of thedivs
. For instance your card is considered anarticle
in semantic HTML. Learn more about HTML Semantics here.
Overall you did an impressive job. Keep pushing and happy coding 👍!
1@shamilussaincPosted over 2 years agoHey @coder-teamie , thanks for your feedback. it will help me to improve my CSS skills. i will try to follow these instructions.
happy coding 😊
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