Ecercise_4_nft_card_component with SASS and a lot of love
Design comparison
Solution retrospective
I used some sass sheets to keep everything tidy, tell me what you think. I'm waiting for advice on responsive design. For ::hover I added a background below the image. This solution turned out to be the best but the background was 4px larger than the image (can anyone tell me why?). I inserted icon-view.svg in ::after but had problems with its position so I had to make two media queries, one larger than 900px and one smaller than 375px; Despite the media queries settings, when I zoom-in and zoom-out with ctrl + the position of icon-view.svg tends to shift slightly. If you have any suggestions I will be happy to hear them. Tell me what you think, I am waiting for your advice and would like to know if I have done too many steps or if everything is fine. Thank you all for your time. I love you <3
Translated with www.DeepL.com/Translator (free version)
Community feedback
- @correlucasPosted about 2 years ago
👾Hello @fedementre, Congratulations on completing this challenge!
Great code and great solution! I’ve few suggestions for you that you can consider adding to your code:
1.Add transitions to make the interaction smoother while the element gets hovered, you can use a value like
transition: all ease-in 0.5s
.2.Use units as
rem
orem
instead ofpx
to improve your performance by resizing fonts between different screens and devices.To save your time you can code your whole page using
px
and then in the end use a VsCode plugin called px to rem here's the link → https://marketplace.visualstudio.com/items?itemName=sainoba.px-to-rem to do the automatic conversion or use this website https://pixelsconverter.com/px-to-rem3.Use a CSS reset to avoid all the problems you can have with the default CSS setup, removing all margins, and making the images easier to work, see the article below where you can copy and paste this CSS code cheatsheet: https://piccalil.li/blog/a-modern-css-reset/
✌️ I hope this helps you and happy coding!
Marked as helpful0@fedementrePosted about 2 years ago@correlucas Wow! These tips are explosive!
transition: all ease-in 0.5s;
makes everything smoother and interesing. Instead the px to rem conversion plug-in I tried it and it's amazing! Thanks also for the CSS reset code, it's valuable material <3 love you! What do you think my problem related to icon-view position doing zoom-in and zoom-out with ctrl + is due to? Do you have any solutions? Meanwhile thank you very much and I hope you can give me more tips in the future! <30@correlucasPosted about 2 years ago@fedementre Hey Fedementre, I'm happy to hear that. I think I guess what happened with the zoom
Try to use:
.img_container:hover .hover_bg_container:after { content: url(images/icon-view.svg); position: absolute; top: 0; right: 0; bottom: 0; left: 0; /* transform: translate(-50%, -50%); */ }
And the position relative in the img box
👨💻Here's my solution for this challenge if you wants to see how I build it: https://www.frontendmentor.io/solutions/nft-preview-card-vanilla-css-custom-design-and-hover-effects-b8D1k9PDmX
Marked as helpful0@fedementrePosted about 2 years ago@correlucas Unfortunately, this is not the solution but I thank you for trying! <3
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