The Humble `img` Element And Core Web Vitals

Addy Osmani on images in HTML:

The humble <img> element has gained some superpowers over the years. Given how central it is to image optimization on the web, let’s catch up on what it can do and how it can


The post The Humble `img` Element And Core Web Vitals appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.


This content originally appeared on CSS-Tricks and was authored by Chris Coyier

Addy Osmani on images in HTML:

The humble <img> element has gained some superpowers over the years. Given how central it is to image optimization on the web, let’s catch up on what it can do and how it can help improve user experience and the Core Web Vitals.

Addy does a good job of translating stuff like this into Instagram posts, so I’ll embed that here:

I’d say this stuff is required knowledge for any HTML developer1. Images affect a site’s performance. Images affect a site’s accessibility. Images affect a site’s UX. Images effect a site’s SEO. That’s not stuff you can sluff off. There is a lot of stuff to know, but that’s the job.

I’m still really curious about this decoding="async" stuff. I’ve read some things that suggest it’s best to have this on all images (though Addy doesn’t suggest this, but doesn’t provide guidance either). I don’t yet understand how best to use this attribute, but if it does turn out that it’s “all the time,” I think we should push browsers to make that behavior the default so we don’t have to bother with the attribute.

I also see Addy suggests loading the hero image as early as possible, but no further trickery. I’m curious if this trick we covered about just not loading the hero at all (until interaction) in an effort to trick CWV into higher numbers will end up being a good practice, or bad.


  1. I don’t hear the term “HTML developer” thrown around much, but I like it. For example, people regularly use “React developer” to describe those who do React development. If you write code that ends up as the DOM, you’re an HTML developer. You’re responsible for the experience that HTML delivers.

Direct Link to ArticlePermalink


The post The Humble `img` Element And Core Web Vitals appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.


This content originally appeared on CSS-Tricks and was authored by Chris Coyier


Print Share Comment Cite Upload Translate Updates
APA

Chris Coyier | Sciencx (2021-05-17T22:38:06+00:00) The Humble `img` Element And Core Web Vitals. Retrieved from https://www.scien.cx/2021/05/17/the-humble-img-element-and-core-web-vitals-2/

MLA
" » The Humble `img` Element And Core Web Vitals." Chris Coyier | Sciencx - Monday May 17, 2021, https://www.scien.cx/2021/05/17/the-humble-img-element-and-core-web-vitals-2/
HARVARD
Chris Coyier | Sciencx Monday May 17, 2021 » The Humble `img` Element And Core Web Vitals., viewed ,<https://www.scien.cx/2021/05/17/the-humble-img-element-and-core-web-vitals-2/>
VANCOUVER
Chris Coyier | Sciencx - » The Humble `img` Element And Core Web Vitals. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/05/17/the-humble-img-element-and-core-web-vitals-2/
CHICAGO
" » The Humble `img` Element And Core Web Vitals." Chris Coyier | Sciencx - Accessed . https://www.scien.cx/2021/05/17/the-humble-img-element-and-core-web-vitals-2/
IEEE
" » The Humble `img` Element And Core Web Vitals." Chris Coyier | Sciencx [Online]. Available: https://www.scien.cx/2021/05/17/the-humble-img-element-and-core-web-vitals-2/. [Accessed: ]
rf:citation
» The Humble `img` Element And Core Web Vitals | Chris Coyier | Sciencx | https://www.scien.cx/2021/05/17/the-humble-img-element-and-core-web-vitals-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.