Drupal is a registered trademark of Dries Buytaert
Release: Dynamic Entity Reference 3.2.3 Minor update available for module dynamic_entity_reference (3.2.3). Release: Charts 5.2.3 Minor update available for module charts (5.2.3). Release: amazee.ai Private AI Provider 1.3.5 Minor update available for module ai_provider_amazeeio (1.3.5). Release: Search and Replace Scanner 2.0.0-beta5 New beta version released for module scanner (2.0.0-beta5). Usage Milestone: jQuery UI TouchPunch Module jquery_ui_touch_punch crossed 1,000 active installs. Release: Easy LQP 2.0.4 Minor update available for module easy_lqp (2.0.4). Release: LiteLLM AI Provider 1.3.0 Minor update available for module ai_provider_litellm (1.3.0). Release: Varbase Core 10.0.59 Minor update available for module varbase_core (10.0.59). Release: Database Info Schema 1.1.3 Minor update available for module database_info_schema (1.1.3). Module Revived: MaxLength 3.2.0 Module maxlength updated after 11 months of inactivity (3.2.0).

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

Activity

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

Release Timeline

Releases

Version Type Release date
3.0.1 Stable Jun 21, 2026
2.0.6 Stable Jun 21, 2026
3.0.0 Stable Jun 20, 2026
2.0.5 Stable Jun 20, 2026