Skip to content

07. Priority Hints

Priority hints allow you to indicate the relative importance of resources to the browser, helping optimize page load performance. By using attributes like fetchpriority and loading, you can guide browsers to prioritize critical resources and defer non-critical ones. Understanding priority hints helps create faster-loading web pages.

Indicate resource priority:

<!-- High priority -->
<img src="hero.jpg" alt="Hero" fetchpriority="high">
<!-- Low priority -->
<img src="decoration.jpg" alt="Decoration" fetchpriority="low">

Control when resources load:

<!-- Lazy load -->
<img src="image.jpg" alt="Image" loading="lazy">
<!-- Eager load (default) -->
<img src="critical.jpg" alt="Critical" loading="eager">
<img src="hero.jpg" alt="Hero image" fetchpriority="high" loading="eager">
<img src="logo.png" alt="Logo" fetchpriority="high">
<img src="footer-image.jpg" alt="Footer" loading="lazy" fetchpriority="low">
<!-- Good: High priority for critical content -->
<img src="hero.jpg" alt="Hero" fetchpriority="high">
<!-- Good: Low priority for non-critical -->
<img src="decoration.jpg" alt="Decoration" fetchpriority="low">
<!-- Good: Lazy load below-the-fold images -->
<img src="image.jpg" alt="Image" loading="lazy">