Design comparison
Solution retrospective
The stuff I learned from my previous Challenge such as the use of Flex box. This time, I started following the mobile first design.
What challenges did you encounter, and how did you overcome them?The pseudo elements can be challenging to style. I took time in aligning list styles and found out about the use of list-style-position.
What specific areas of your project would you like help with?Would appreciate any feed back on what I could have done better.
Community feedback
- @0xabdulkhaliqPosted 6 months ago
Hello there π. Congratulations on successfully completing the challenge! π
- I have a suggestion regarding your code that I believe will be of great interest to you.
PREVENT LAYOUT SHIFTS π:
- Your solution needs to be improved to prevent Cumulative Layout Shift (CLS) which results a visually unstable or janky website, particularly on mobile devices.
- This can happen because of leaving the Image and/or video elements without adding explicit
width
andheight
attributes.
- The multimedia elements like
img
which aren't explicitly declared with height and width attributes are usually re-sized using CSS (either on the image itself or the parent container). When this happens, the browser can only determine their dimensions and allocate space for them once it starts downloading the 'unsized images' and/or videos.
- You may notice that when the browser fetches these images, your page content is constantly being pushed down or moved around from its original position (i.e., layout shifts) as the browser resizes the images and positions them on your page.
- Currently the
img
element have no explicitwidth
andheight
to prevent CLS,
<img src="assets/image-omelette.jpeg" alt="image-omelette">
- Here's an example which could help you to prevent CLS,
<img src="assets/image-omelette.jpeg" alt="image-omelette" width="1312" height="600">
- The
height
andwidth
needs to have the actual measurements of that corresponding image.
- I would like to recommend the article Use explicit width and height on image elements from GTMetrix to learn more about Layout Shifts and why's it needs to be prevented.
.
I hope you find this helpful π Above all, the solution you submitted is great !
Happy coding!
0 - @mickoymousePosted 6 months ago
This is really good. I haven't thought about using a table for the Nutrition section.
Maybe you could start adding usage of variables for your colors, fonts, etc. That way, it would be easier to change in the future if need be.
Overall, great work! Couldn't have done it better myself.
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