Design comparison
Solution retrospective
This is my 3rd challenge of Frontend Mentor.
Community feedback
- @AGutierrezRPosted 10 months ago
Hello there 👋. Good job on completing the challenge!
I have some suggestions about your code that might interest you.
General Structure and HTML:
-
Wrap the primary content within the
<main>
tag instead of using it as a standalone component like a<div>
. -
All the content should be contained within landmarks. Every page minimally needs a
<main>
element. -
Consider using
<picture>
tag that is commonly used for responsive images, here you can specify the difference image sources for different screen sizes and devices. For example:<picture> <source media="(min-width: 640px)" srcset="/images/image-product-desktop.jpg "> <img src="/images/image-product-mobile.jpg" alt=""> </picture>
Check that srcset and src are correct and change the media if you want the desktop image to kicks in on a previous or later screensize.
CSS and Styling:
-
To center the card use the following styles
body { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
-
Implement CSS custom properties to define and utilize project colors more easily.
-
Avoid using
px
forfont-size
, you could read this article to learn why. Letter spacing and line height must not be inpx
, userem
for all the font-related properties. -
Let the content decide the height of the elements. Use padding and margins strategically for this purpose.
-
The
body
should not have itsheight
limited. Instead of usingheight: 100vh
, usemin-height: 100vh
.
Accessibility and Semantic HTML:
- The image is decorative, so it alt text must be empty:
alt=""
.
I hope you find this helpful 😁. Most importantly, your submitted solution is fantastic!
Happy coding!
Marked as helpful1 -
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