Place two text fields within a single  class
Hope this will help you,

In Drupal 7 you can achieve it by using the #prefix and #suffix properties in hook_form_alter().

   /**
    * Implements hook_form_alter().
    */
    function hook_form_alter(&amp;$form, &amp;$form_state, $form_id) {
      switch ($form_id) {
        case 'user_login':
        case 'user_login_block':
          $form['name']['#prefix'] = '&amp;#60;div class="username-password-wrapper"&amp;#62;';
          $form['pass']['#suffix'] = '&amp;#60;/div&amp;#62;';
          break;
      }
    }