Skip to content

Conversation

@MoritzWeber0
Copy link
Member

@MoritzWeber0 MoritzWeber0 commented Jul 19, 2025

So far, images don't set a fixed height for images. This leads to layout shifts since CSS can only recognize the size of the image when loaded.

By setting the aspect ratio on the img element, the browser can already pre-allocate the necessary space. When the image is loaded, the layout no longer shifts.

Layout shifts are one of the main complaints in the Google Lighthouse report:
image

For more information, check the Google recommendations for image spacing: https://web.dev/articles/optimize-cls?utm_source=lighthouse&utm_medium=devtools#images-without-dimensions

Resolves #73

@MoritzWeber0 MoritzWeber0 requested a review from therobrob July 19, 2025 09:49
@netlify
Copy link

netlify bot commented Jul 19, 2025

Deploy Preview for fipguide ready!

Name Link
🔨 Latest commit f1177f5
🔍 Latest deploy log https://app.netlify.com/projects/fipguide/deploys/687d12718486c30008e2ed49
😎 Deploy Preview https://deploy-preview-248--fipguide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

So far, images don't set a fixed height for images. This leads to
layout shifts while loading since CSS can only recognize the size
of the image when loaded.

By setting the aspact ratio on the img-element, the browser can
already pre-allocate the necessary space. When the image is loaded,
the layout no longer shifts.
@MoritzWeber0 MoritzWeber0 force-pushed the fix/seo-image-ratio branch from d092530 to 904e37f Compare July 19, 2025 09:51
@therobrob
Copy link
Member

Hi @MoritzWeber0, i've noticed the error in footer.hmtl already. There were some email-notifications about it and i already fixed it. There is no need to fix this in this PR. :)

@therobrob therobrob merged commit 4b1f886 into main Jul 20, 2025
7 checks passed
@therobrob therobrob deleted the fix/seo-image-ratio branch July 20, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check and fix lighthouse findings

3 participants