Design comparison
Solution retrospective
Please tell me how I can improve and best practices
Community feedback
- @numan-iftikharPosted about 2 years ago
Hi, you did fantastic work with your design. It's almost pixel perfect. Here are some suggestions:
- Use
main
tag to wrap all the content - Get your HTML right
- Don't use unnecessary
div
tags - Always use
rem
instead ofpx
for settingfont-size
property - Avoid
text-align: center
in every element
Marked as helpful0@amch123Posted about 2 years agoHi @numan-iftikhar, please tell me how I can improve text-align: center?
0@vanzasetiaPosted about 2 years ago@amch123 You can put the
text-align: center
on themain
element. 🙂Marked as helpful0@numan-iftikharPosted about 2 years ago@amch123 You can add
text-align: center
to the parent element, in this case, thebody
ormain
element (if you use it). All the content inside the parent element will be centered :)0 - Use
- @Cooger17Posted about 2 years ago
Hi @amch123! Great solution on this challenge
There some tips to improve your code:
1- Use <main> instead of <div> to wrap the card container. This way you show that this is the main block of content and also replace the div with a semantic tag.
2- 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/
3- A better way to work this solution image, the product image is by using <picture> to wrap it on the html instead of using it as <img> or background-image (with the css). Using <picture> you wrap both images (desktop and mobile) and have more control over it, since you can set in the html when the images changes setting the screen size for each image.ote 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.
Marked as helpful0@vanzasetiaPosted about 2 years ago@Cooger17
In this case, the image is consistent across all screen sizes. So, there's no need to use
picture
element.picture
element is used to provide different versions of the same image. I recommend reading the MDN documentation for thepicture
element to know more about the use cases of thepicture
element.So, I recommend using
img
element instead.0 - @jake4369Posted about 2 years ago
Hi, your solution is pretty spot on, it looks really good and very close to the design.
I only have a few suggestions but of instead of using <div class="contenedor">, you can use a <main></main> tag, this should remove the warning "All page content should be contained by landmarks". Also, there is no need to wrap every element in <div></div> tags. Other than that it's a pretty nice, clean solution, great job!!
Marked as helpful0
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