Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Geocoder 8.x-4.37 Minor update available for module geocoder (8.x-4.37). Release: Paragraphs Editor Enhancements 10.2.0 Minor update available for module paragraphs_ee (10.2.0). Release: Paragraphs Editor Enhancements 10.1.1 Minor update available for module paragraphs_ee (10.1.1). Release: Trash 3.0.34 Minor update available for module trash (3.0.34). Release: Paragraphs Editor Enhancements 10.0.9 Minor update available for module paragraphs_ee (10.0.9). Release: Trash 3.1.0 Minor update available for module trash (3.1.0). Release: MCP Sentinel 2.22.1 Minor update available for module mcp_sentinel (2.22.1). Release: Menu Autopilot 1.3.2 Minor update available for module menu_autopilot (1.3.2). Module Revived: CVA (Class Variance Authority) 1.0.1 Module cva updated after 7 months of inactivity (1.0.1). Security Coverage: Pixie Dark Theme pixie_dark now has official Drupal security advisory coverage.

Simple Background image formatter

3,664 sites Security covered Drupal 10–11
View on drupal.org

This module provides a formatter for image fields that displays images as a CSS background on a `div` element. It integrates with Drupal's field UI, Views, and image styles, offering options for inline styles or custom CSS selectors to control how the background image is applied. This allows for more flexible image display, including linking the background image to content or a custom URL.

This module provides an image formatter that allows you to display the image in a div as background image.
The module extends Drupal's images field. Because settings are attached to the entity, it's very easy to setup and manage.

Features

1. No module dependencies (Other than image).
2. Works with Drupal's field UI.
3. Works with Views.
4. Integrates with Drupal's image styles.
5. Offers 2 modes. (Inline Style & CSS Selector)
6. Works with Media image fields.
7. Allows inline background images to link to the content or to a custom URL.
8. Supports tokens in custom links when the Token module is enabled.
9. Provides entity context variables for template overrides.
10. Provides theme suggestions for entity type, bundle, field, and entity ID.

Inline Style

Instead of generating the normal img markup we now generate the div with an inline style.

This

<img src="PATH" />

is changed to

<div class="[YOUR CLASS]" style="background-image: url('[ABSOLUTE PATH]')">&nbsp;</div>

CSS Selector

This option prevents the img tag from being printed to the dom and instead generates a stylesheet in the dom.

The expected output will be something like this.

<style>
[YOUR SELECTOR]_[ENTITY_ID] {background-image: url('[ABSOLUTE PATH]');}
</style>

Basic Installation and usage.

1. Download and enable the module.
2. Go to Administration > Structure > Content Types (admin/structure/types).
3. Click on Manage Display for the relevant content type. (admin/structure/types/manage/page/display)
4. Change the Format to Background Image for the relevant image field.

Similar module

Depends on

Dependencies of the latest stable release

  • image Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Jun 2026
Latest release
2 months ago
Releases (12 mo)
4 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
3.0.1 Stable 10–11 Jun 21, 2026
2.0.6 Stable 9–11 Jun 21, 2026
3.0.0 Stable 10–11 Jun 20, 2026
2.0.5 Stable 9–11 Jun 20, 2026