v1.4.0
  1. Home
  2. Get started
  3. Foundations
  4. Patterns
    1. Accordion
    2. Autocomplete
    3. Button
    4. Callout
    5. Chat
    6. Description List
    7. Details
    8. Expand Text
    9. Fallback Image
    10. Feedback
    11. Focus Indicator
    12. Footer
    13. Header
    14. Hero
    15. IIIF Image
    16. Link
    17. Page Title
    18. Results per Page
    19. Service Switcher
  5. What's new

Fallback Image

Fallback image maintains consistent spacing and alignment when content without an image appears alongside siblings that typically have images.

Maintain visual consistency in layouts when some content lacks images.

When to use

Use fallback images when displaying collections of content where some items have images and others don't. This is especially useful for search results, listings, cards, or any grid-based layouts where visual consistency is important for readability.

How to use

Use consistently across your site. Apply the fallback image pattern in the same contexts throughout your website to create predictable user experiences.

Consider your layout. The fallback image displays at a 3:2 aspect ratio by default, which works well for most content layouts, but you can customize this.

Default

<pennlibs-fallback-img style="max-width: 26rem; margin: 1rem;"></pennlibs-fallback-img>

Add your styles

<style>
  pennlibs-fallback-img {
    max-width: 20rem;
    margin: 1rem;
    aspect-ratio: 1;
    border-radius: var(--pl-border-radius-subtle);
    background: var(--pl-color-bg-subtle-brand);
  }
</style>

<pennlibs-fallback-img></pennlibs-fallback-img>

Accessibility

This pattern includes an empty alt attribute since it serves as decoration and doesn't convey essential information. Screen readers will skip over it, which provides the intended behavior for placeholder content.

Design System

Get started Content & writing v1.4.0