IssueRaiser

Set width and height attributes to img automatically

When you test your webpage on Google's speed tool lighthouse, it shows that images don't have explicit width and height attributes. Warning: "Image elements do not have explicit width and height". I have read that this can affect Cumulative Layout Shift value, which involves SEO/Performance marks directly. Would be a good feature just to add this to every image we add to Oxygen? I can do this manually now, on attributes setting data and value respectively but it's a bit clunky to do it one by one. I just set it to 100% so it doesn't affect my width and height setted previously but avoid the Google warning on lighthouse. My only concern is that when you add this to an image, the 'size' is modified on the backend visually, but it's showed correctly on the frontend. So the idea is to do this after you finish the website, when you are optimizing. Backend view: Screenshot 1: Left image has attributes. Right doesn't. ![Screenshot_2](https://user-images.githubusercontent.com/16625897/100858198-f75c8180-348d-11eb-8ce6-0c9d5a78cc5b.jpg) Frontend view: Screenshot 2: Left image has attributes. Right doesn't. ![Screenshot_3](https://user-images.githubusercontent.com/16625897/100858384-325eb500-348e-11eb-97b9-0ab6f34556c9.jpg)

Posted by JandJElche on Dec 2, 2020, 10:05 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

ux (Marketing)

Set width and height attributes to img automatically

JandJElcheDec 2, 2020, 10:05 AM

When you test your webpage on Google's speed tool lighthouse, it shows that images don't have explicit width and height attributes. Warning: "Image elements do not have explicit width and height". I have read that this can affect Cumulative Layout Shift value, which involves SEO/Performance marks directly. Would be a good feature just to add this to every image we add to Oxygen? I can do this manually now, on attributes setting data and value respectively but it's a bit clunky to do it one by one. I just set it to 100% so it doesn't affect my width and height setted previously but avoid the Google warning on lighthouse. My only concern is that when you add this to an image, the 'size' is modified on the backend visually, but it's showed correctly on the frontend. So the idea is to do this after you finish the website, when you are optimizing. Backend view: Screenshot 1: Left image has attributes. Right doesn't. ![Screenshot_2](https://user-images.githubusercontent.com/16625897/100858198-f75c8180-348d-11eb-8ce6-0c9d5a78cc5b.jpg) Frontend view: Screenshot 2: Left image has attributes. Right doesn't. ![Screenshot_3](https://user-images.githubusercontent.com/16625897/100858384-325eb500-348e-11eb-97b9-0ab6f34556c9.jpg)

Comments (0)

No comments yet. Start the discussion.

Comment on this issue