Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Custom Body Class

Security covered Under active development 1,973 sites

This module allows you to add custom CSS classes to the `<body>` tag of specific node pages or pages of a particular content type.

Custom Body Class is a lightweight Drupal module that allows site administrators and content editors to add custom CSS classes to the <body> element of individual content pages and content types.

Adding a custom body class makes it easier to apply page-specific or content-type-specific styling without requiring changes to the site's theme templates.

Features

  • Add custom CSS classes to the <body> tag of individual content pages.
  • Add custom CSS classes based on content type.
  • Apply page-specific styling without modifying theme templates.
  • Useful for creating targeted layouts and styling for specific content types or pages.
  • Simple configuration with minimal overhead.

Usage

After enabling the module, configure the custom body class for the required content type or individual content page.

The configured class is added to the HTML <body> element when the corresponding page is rendered.

This allows theme developers and site builders to target specific pages or content types with CSS.

For example:

<span class="hljs-selector-class">.my-custom-page</span> {
  <span class="hljs-comment">/* Page-specific styles */</span>
}

Use Cases

Custom Body Class can be useful when you need to:

  • Create a unique layout for a specific content type.
  • Apply page-specific CSS.
  • Add styling variations for landing pages.
  • Customize the appearance of selected content pages.
  • Differentiate sections of a website without creating separate themes or templates.
Drupal 8–11

Ask your assistant about Custom Body Class

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Dec 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
2.0.2 Stable 8–11 Oct 15, 2025
2.0.1 Stable 8–10 Feb 29, 2024
2.0.0 Stable 8–10 Dec 10, 2023