Design comparison
Solution retrospective
Hi! This is my solution to the Product preview card component. I use Flex for the layout but I am not sure if I actually make full use of it🤔 I have learned a lot from the feedback on my last challenge! I really appreciate it. If there is anything I can improve, don't hesitate to drop a comment. Thanks!😊
Community feedback
- @correlucasPosted about 2 years ago
👾Hello Yiwen Chen, congratulations for your first solution!👋 Welcome to the Frontend Mentor Coding Community!
You’ve done really good work here putting everything together, I’ve some suggestions you can consider applying to your code to improve the html markup/semantic:
THE PICTURE TAG is a shortcut to deal with the multiple images in this challenge. So you can use the
<picture>
tag instead of importing this as an<img>
or using a div withbackground-image
. Use it to place the images and make the change between mobile and desktop, instead of using adiv
orimg
and set the change in the css withdisplay: none
with the tag picture is more practical and easy. Note that for SEO / search engine reasons isn’t a better practice import this product image with CSS since this will make it harder to the image. Manage both images inside the<picture>
tag and use the html to code to set when the images should change setting the devicemax-width
depending of the device desktop + mobile.Check the link for the official documentation for
<picture>
in W3 SCHOOLS:https://www.w3schools.com/tags/tag_picture.asp
Use a CSS reset to avoid all the problems you can have with the default CSS setup, removing all margins, 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@CHEN-YiWenPosted about 2 years ago@correlucas Thank you so much for the suggestion! I didn't the existence of <code><picture></code>! It is definitely going to make placing the images much easier. I will try it out. Thanks again😄
0 - @UrbanskiDevPosted about 2 years ago
Hello Yiwen Chen !
Congratulation for finishing your project
Some suggestions to make it better !
- You used an hover effect on your button, which is a good design idea to use, but the change is kinda brutal. You can make it smoother by adding a transition on your button !
transition: 0.3s ease-in-out;
I give you a like about transition on a button to learn more about it :
- In your HTML files, you can use the latest HTML semantic available ! You can replace your
<div class=container> </div>
with a<main></main>
tag. It is important because a div tag doesn't have any meaning by default while a main tag has a meaning !
I give you a link about HTML semantics :
I hope it helps you, keep learning and happy coding !
Marked as helpful0@CHEN-YiWenPosted about 2 years ago@UrbanskiDev Hi! Thanks for the suggestions again. It's really helpful😊 I didn't realize that I could use a transition to make the hover effect look smoother!
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