Recipes
Customizing your own Logo Link fallbacks
Learn how to gracefully handle missing logo images by implementing fallback mechanisms
When working with Logo Link, it’s crucial to have a fallback strategy in place. This ensures a smooth user experience even when the primary logo image fails to load. While we already provide several built-in fallback options, here’s how to implement a custom fallback system using HTML and CSS for more specific needs.
The Fallback Mechanism
Our approach uses a combination of a fallback div and an image element. The fallback div contains custom text or a placeholder, while the image element attempts to load the actual logo.
Use this CSS to style your fallback mechanism:
How It Works
- The
.wrapper
div creates a circular container for the logo. - The
.fallback
div is positioned absolutely within the wrapper, displaying custom text. - The
.icon
image is layered on top of the fallback div. - If the image loads successfully, it covers the fallback div.
- If the image fails to load, the fallback div remains visible, showing the custom text.
Visualize our live example on jsFiddle.