I'm trying to style the login and registration form in different styles in my drupal 7 website. By default they share the same styles. Is there any way to change that?

2 Answers 2


Add this to your theme's template.php file:

function MYTHEME_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'user_register_form') {
    $form['#attached']['css'][] = path_to_theme() . '/css/user-register-form.css';
  elseif ($form_id == 'user_login') {
    $form['#attached']['css'][] = path_to_theme() . '/css/user-login.css';

And then define your two css files.


take a look at the themekey module:

ThemeKey allows you to define simple or sophisticated theme-switching rules which allow automatic selection of a theme depending on current path, taxonomy terms, language, node-type, and many, many other properties. It can also be easily extended to support additional properties exposed by other modules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.