diff --git a/domain.admin.inc b/domain.admin.inc
index 47dda4d..a91e96a 100644
--- a/domain.admin.inc
+++ b/domain.admin.inc
@@ -342,6 +342,29 @@ function domain_configure_form($form, &$form_state, $user_submitted = FALSE) {
       Enter one path per line.  See the README for more details.')
   );
 
+  $form['domain_classes'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Domain-specific CSS classes'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE
+  );
+  // Get the available tokens.
+  $prefixes = array('current-domain', 'default-domain');
+  module_load_include('inc', 'domain', 'domain.tokens');
+  $info = domain_token_info();
+  foreach($prefixes as $prefix) {
+    foreach($info['tokens']['domain'] as $token => $data) {
+      $tokens[] = t('!token : !description', array('!token' => "[$prefix:$token]", '!description' => $data['description']));
+    }
+  }
+  $form['domain_classes']['domain_classes'] = array(
+    '#type' => 'textarea',
+    '#rows' => 5,
+    '#cols' => 40,
+    '#default_value' => variable_get('domain_classes', 'domain-[current-domain:machine_name]'),
+    '#description' => t('Add the following classes to the <em>body</em> tag of every page. Enter one class per line. The following token replacements are allowed: !tokens', array('!tokens' => theme('item_list', array('items' => $tokens)))),
+  );
+
   // Allow submodules to add elements to the form.
   $modules = module_implements('domain_form');
   if (!empty($modules)) {
diff --git a/domain.module b/domain.module
index ba63a93..5e59cfc 100644
--- a/domain.module
+++ b/domain.module
@@ -3453,3 +3453,33 @@ function domain_batch_actions() {
   drupal_alter('domain_batch', $batch);
   return $batch;
 }
+
+/**
+ * Implements hook_preprocess_page().
+ */
+function domain_preprocess_html(&$variables) {
+  $classes = domain_page_classes();
+  foreach ($classes as $class) {
+    $variables['classes_array'][] = $class;
+  }
+}
+
+/**
+ * Determine the page classes to apply to the current domain.
+ *
+ * @return
+ *  An array of domain-specific HTML-safe class names.
+ */
+function domain_page_classes() {
+  $classes = array();
+  $settings = variable_get('domain_classes', 'domain-[current-domain:machine_name]');
+  if (!empty($settings)) {
+    $vars = check_plain(token_replace($settings));
+    $vars = preg_replace('/(\r\n|\n)/', "\r\n", $vars);
+    $vars = explode("\r\n", token_replace($vars));
+    foreach($vars as $var) {
+      $classes[] = drupal_clean_css_identifier(trim($var));
+    }
+  }
+  return $classes;
+}
diff --git a/domain.tokens.inc b/domain.tokens.inc
index 1eb4ef8..876dac2 100644
--- a/domain.tokens.inc
+++ b/domain.tokens.inc
@@ -31,6 +31,10 @@ function domain_token_info() {
     'name' => t('Domain id'),
     'description' => t('The domain ID.'),
   );
+  $info['tokens']['domain']['machine_name'] = array(
+    'name' => t('Domain machine name'),
+    'description' => t('The domain machine identifier.'),
+  );
   $info['tokens']['domain']['name'] = array(
     'name' => t('Domain name'),
     'description' => t('The domain name.'),
@@ -62,6 +66,9 @@ function domain_tokens($type, $tokens, array $data = array(), array $options = a
         case 'id':
           $replacements[$original] = $domain['domain_id'];
           break;
+        case 'machine_name':
+          $replacements[$original] = $domain['machine_name'];
+          break;
         case 'name':
           $replacements[$original] = $sanitize ? check_plain($domain['sitename']) : $domain['sitename'];
           break;
