Addy Osmani on pictures in HTML:
The common-or-garden <img> component has gained some superpowers over time. Given how central it’s to picture optimization on the net, let’s compensate for what it may possibly do and the way it might help enhance consumer expertise and the Core Net Vitals.
Addy does job of translating stuff like this into Instagram posts, so I’ll embed that right here:
I’d say these items is required data for any HTML developer1. Pictures have an effect on a website’s efficiency. Pictures have an effect on a website’s accessibility. Pictures have an effect on a website’s UX. Pictures impact a website’s website positioning. That’s not stuff you’ll be able to sluff off. There’s plenty of stuff to know, however that’s the job.
I’m nonetheless actually interested in this decoding=”async” stuff. I’ve learn some issues that counsel it’s finest to have this on all pictures (although Addy doesn’t counsel this, however doesn’t present steering both). I don’t but perceive how finest to make use of this attribute, but when it does end up that it’s “on a regular basis,” I feel we should always push browsers to make that conduct the default so we don’t must trouble with the attribute.
I additionally see Addy suggests loading the hero picture as early as doable, however no additional trickery. I’m curious if this trick we lined about simply not loading the hero in any respect (till interplay) in an effort to trick CWV into larger numbers will find yourself being follow, or dangerous.
I don’t hear the time period “HTML developer” thrown round a lot, however I prefer it. For instance, individuals often use “React developer” to explain those that do React growth. When you write code that finally ends up because the DOM, you’re an HTML developer. You’re liable for the expertise that HTML delivers. ⮑
You may assist CSS-Methods by being an MVP Supporter.