How do display .avif images in not supporting browsers?

1.9k Views Asked by At

i want to all my big .png files to .avif . But Browsers like MS Edge etc. do not support .avif images. Is there any way to display .avif files in f.e. Edge, or provide the Browser two images (.png and .avif) and the browser decides, which image to display?

My Code:

<a href="./"><img src="img/logo.avif" alt="Logo – Test"></a>

2

There are 2 best solutions below

1
harry On BEST ANSWER

There is no way to display .avif file in MS Edge, but there is a way for the browser to decide which format to display.

<a href="./">
  <picture>
    <source srcset="img/logo.avif" type="image/avif">
    <source srcset="img/logo.png" type="image/png">
    <img src="img/logo.png" alt="Logo – Test">
  </picture>
</a>
0
user1069816 On

Since January 2024 Edge (and all major browsers) support AVIF files