Advertising sustains the DA. Ads are hidden for members. Join today

Contributed modules

Style (CSS) Settings

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

This guide has not yet been reviewed by Contributed modules maintainer(s) and added to the menu.

Allows any module or theme to have their CSS attributes configurable from the UI just by suffixing default CSS values with a code comment. These are then substituted in a separate rewritten CSS file by Drupal variables or theme settings. The CSS is functional even if this module is not installed.

  • The Style (CSS) Settings module is primarily intended for theme and module maintainers.
  • It can also be used for customizations by anyone with basic coding skills, for example, to provide a patch for a project that could use some CSS to be configurable or to offer a UI to give some validated control to a webmaster over a site's styling.
  • It might simply be needed because a theme or module declares it as a (soft-)dependency.

Cache and performance

All is cached so the performance impact is neglectable. The rewritten CSS files are included in the CSS aggregation mechanism.

Code example

Code example for developers to add UI configurable CSS to their project.

How to add configurable CSS to your module, theme or site?

Just by suffixing default CSS values (plus unit) with a code comment in the css, scss or less file (7.x-2.0 version).

How to provide form elements on your settings page?

Settings can be added to your settings page the usual way.

Guide maintainers

lolandese's picture