Drupal is a registered trademark of Dries Buytaert
cms 2.1.3 Update released for Drupal core (2.1.3)! drupal 10.5.11 Update released for Drupal core (10.5.11)! drupal 11.3.11 Update released for Drupal core (11.3.11)! drupal 11.2.13 Update released for Drupal core (11.2.13)! drupal 10.6.10 Update released for Drupal core (10.6.10)! cms 2.1.2 Update released for Drupal core (2.1.2)! drupal 11.1.10 Update released for Drupal core (11.1.10)! drupal 10.5.10 Update released for Drupal core (10.5.10)! drupal 10.4.10 Update released for Drupal core (10.4.10)! drupal 11.2.12 Update released for Drupal core (11.2.12)! drupal 11.3.10 Update released for Drupal core (11.3.10)! drupal 10.6.9 Update released for Drupal core (10.6.9)! drupal 10.6.8 Update released for Drupal core (10.6.8)! drupal 11.3.9 Update released for Drupal core (11.3.9)! drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)!

Body Attributes provides a flexible way to add CSS classes and HTML attributes to page elements in Drupal based on configurable rules and conditions.

Features

  • Rule-Based Targeting: Create multiple rules with custom priorities (weights).
  • Flexible Zones: Target the html tag, body tag, or specific structural elements like header, main, and footer.
  • Custom Selectors: Use CSS selectors to target specific elements on the page beyond standard structural tags.
  • Visibility Conditions: Apply attributes based on:
  • Request Path: Target specific pages or patterns (e.g., /blog/*).
  • Node Type: Apply attributes only to specific content types (e.g., "Article" or "Product").
  • Developer Friendly: Built using modern Drupal standards (PHP 8.1 Attributes, Strict Typing, and Service-oriented architecture).

How it Works

  • Define a Rule: Navigate to Configuration > User Interface > Body Attributes.
  • Choose a Zone: Select where you want the attribute applied.
  • Set Attribute & Value: Define the class or HTML attribute (e.g., data-mode="dark").
  • Set Conditions: Determine which pages or content types trigger the rule.

Activity

Total releases
2
First release
Mar 2026
Latest release
3 months ago
Release cadence
0 days
Stability
50% stable

Releases

Version Type Release date
1.0.0 Stable Mar 13, 2026
1.0.x-dev Dev Mar 13, 2026