Adding Conditional CSS and Javascript for Drupal 7

Last updated March 2, 2020

Check your version

This tutorial covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Sprout Video

In this video we will look at how to add CSS and JavaScript to our site using drupal_add_css() and drupal_add_js(). We will also show using these functions to conditionally add the CSS and JavaScript, within our page preprocess function.

960 Robots