<img> decoding attribute

decoding

The decoding attribute of the tag is used to tell the browser how to parse the image data.

<img src="/images/example.png" alt="Example" decoding="async">

This attribute can take on the following three values:

sync: Decode the image synchronously to ensure it is displayed together with other content.
async: Decode images asynchronously to speed up display of other content.
auto: Default mode, indicating that the decoding mode is not preferred. It's up to the browser to decide which method is more appropriate for the user.
This attribute is similar to using the async attribute on script tags. The time it takes to load the image does not change, but the way it is "decoded" is determined by the decode property. The decoding attribute controls whether the browser is allowed to attempt to load images asynchronously. Asynchronous loading is useful for elements, and may be even more useful for off-screen image objects.

おすすめ

転載: blog.csdn.net/m0_38136631/article/details/128222800