Community Documentation

Base themes and writing your own themes

Last updated April 3, 2013. Created by Itangalo on May 16, 2012.
Edited by slindhurst. Log in to edit this page.

For small websites it is often enough to use a contributed theme, perhaps with a tweak here and there. In professional web development few clients would accept having a site that looks like hundreds or thousands of other Drupal sites.

The art of writing new themes will not be covered in this book, but there is room for two tips for anyone hungry to develop a theme of her own:

  • Instead of building a new theme from scratch, you should use a base theme. This a theme written to be extended and built upon. Using a base theme will save you a lot of work in resetting parts of Drupal's standard markup and you will also get good support for older versions of Internet Explorer (which has a tendency to make web sites look broken). With a good base theme, at least 80% of your theming work can be accomplished by just writing CSS.
  • Instead of hacking and changing your base theme, you should create a sub theme, including only the things separating your theme from the base theme. This allows you to update the base theme when necessary, without jeopardizing your own work.

TIP: The Stark theme, included in Drupal core, is an example of a base theme and more base themes can be found on drupal.org. One good base theme when learning to theme is the Zen theme, the most popular of all Drupal themes. Next to Stark in the theme overview is a link to more information about how to create your own theme.

nobody click here