About Using WebP Images

For browser compatibility, use the new web-optimized WebP images together with a fallback version in a <picture> tag:

{% load static %}
<picture>
  <source type="image/webp" 
    srcset="{% static 'site/img/logo.webp' %}" />
  <source type="image/png" 
    srcset="{% static 'site/img/logo.png' %}" />
  <img src="{% static 'site/img/logo.png' %}" 
    loading="lazy" alt="Logo" />
</picture>

Tips and Tricks User Experience Web Design Development Django 4.2 Django 3.2 Django 2.2 HTML5