This recipe details the steps involved in adding a CSS file to the theme through its .info
file. In this case, we will be adding a CSS file to the mytheme
subtheme that we created earlier in this chapter.
We will be including a CSS file in this theme. Create a folder titled css
within the mytheme
folder at sites/all/themes/mytheme
and within, create a CSS file named mytheme.css
. Open the file in an editor and add the following example rule to it:
* { color: #996633 !important; }
The above rule should override and change the color of all text on the page to a brownish hue. It is assumed that mytheme
is the active/default theme of the site.
Adding a CSS file to a theme is best accomplished through its .info
file. Navigate to the theme's folder at sites/all/themes/mytheme
and open the mytheme.info
file in an editor. Add the following line to this file to include our CSS file:
stylesheets[all][] = css/mytheme.css