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.
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.