Working with CSS

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

Working with CSS in Drupal 7.

CSS overview

Most modern web pages use external style sheets to control the presentation of a page.

Overriding style sheets from modules and base themes

You can override the style sheet provided by Drupal core, contributed modules or even other themes.

Adding style sheets from .info files

This page explains how to add a style sheet using the .info file of a theme. To add a style sheet programmatically, see the API functions

Adding CSS to form or page with attachments

On previous page we learn how to add css using .info file and drupal_add_css(). Adding custom CSS to a page is easy in Drupal, but can be a

Adding styles through the API

Adding styles through the .info file should be sufficient for most themes. Since the .info file is static, style sheets cannot be added

Live_css with .less support

Theming in Drupal has come a long way and the tools now available not only make theming easy but you can style your site very quickly.

Sass techniques and tools

Sass is a meta-language on top of CSS that’s used to describe the style of a document cleanly and structurally, with more power than flat

Standard Drupal core styles and classes

Drupal core takes a modular approach to CSS classes for standard page elements. A number of classes occur throughout a Drupal site. This

Using .clearfix

Drupal 6's “clear-block” class was a Drupalism for functionality which is better known by the CSS Community as “clearfix.” Furthermore,

Supporting "right to left" (RTL) languages

Adding support for RTL (Right to Left) languages involves overriding the lateral styles through cascades and naming the file based on the

Guide maintainers

Mohammed Nur's picture