Reduced the CLS (Cumulative Layout Shift) score to 0
Design comparison
Solution retrospective
I am proud that during this assignment I took the time to gain new knowledge that me helped improve the metric results such as LCP, CLS.
What challenges did you encounter, and how did you overcome them?I forgot that img elements by default have display:inline. That means they are treated as text and have a space below reserved for descender elements. You can get rid of it in a number of ways:
- add a vertical-align:top rule to the image jsFiddle example
- add font-size:0; to the containing div jsFiddle example
- add display:block; to the image jsFiddle example
I found the solution here: https://stackoverflow.com/questions/19212352/div-height-based-on-child-image-height-adds-few-extra-pixels-at-the-bottom
What specific areas of your project would you like help with?none
Community feedback
- @Alex-Archer-IPosted 6 months ago
Wow! I've never heard about space below the img element. And that is new way to load fonts via js. You work is quite interesting! Cool =)
By the way, I can advice you to use relative values (
rem
is better) for font sizes.Happy coding =)
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