You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We all have adaptive layouts nowadays. Why would we still be using the "width" and "height" attributes? Using a CSS width with aspect-ratio, I manage to define a proper placeholder for my images, with no layout shift, and for all devices. I expect it to be recognized by lighthouse.
The text was updated successfully, but these errors were encountered:
goonydev
changed the title
Getting "missing explicit width and height" on piamges despite defining aspect-ratio in CSS
Getting "missing explicit width and height" on pages despite defining aspect-ratio in CSS
Mar 8, 2021
We all have adaptive layouts nowadays. Why would we still be using the "width" and "height" attributes?
Setting an explicit width and height in CSS should pass the audit. In this case, the usage of aspect-ratio instead of height is causing the audit to fail.
I do think images with explicit aspect-ratio and one of height or width should pass the audit as well.
Provide the steps to reproduce
What is the current behavior?
I am getting the "Image elements do not have explicit width and height" issue.
What is the expected behavior?
No error, since I define directly in each IMG tag style="width=100%;aspect-ratio=XXX/YYY".
Environment Information
Related issues
We all have adaptive layouts nowadays. Why would we still be using the "width" and "height" attributes? Using a CSS width with aspect-ratio, I manage to define a proper placeholder for my images, with no layout shift, and for all devices. I expect it to be recognized by lighthouse.
![Screen Shot 2021-03-08 at 8 20 53 AM](https://user-images.githubusercontent.com/17790584/110331382-025d1a00-805a-11eb-8994-109c35f80467.jpg)
The text was updated successfully, but these errors were encountered: