customized login block I made a template for the login block on the main page. It works.

Here is user-login.tpl.php code:

&lt;?php
    $elements = drupal_get_form('user_login_block');
?&gt;
&lt;div class="login"&gt;
    &lt;div class="login_header"&gt;Login&lt;/div&gt;
&lt;?php
print drupal_render($elements["form_id"]);
print drupal_render($elements['name']);
print drupal_render($elements['pass']);
?&gt;
      &lt;div class="forgot_password"&gt;
             &lt;a href="/" class="forgot_password"&gt;Forgot password&lt;/a&gt;
      &lt;/div&gt;
       &lt;input type="submit" name="" value="Log in" /&gt;
       &lt;a href="/" id="sign_up"&gt;Sign up&lt;/a&gt;
&lt;/div&gt;


&lt;form&gt; and &lt;div&gt; tags were added around my template code, breaking the layout. Now the block doesn't float: left.

Here is the rendedered HTML:

&lt;form action="/node?destination=node" method="post" id="user-login-form" accept-charset="UTF-8"&gt;&lt;div&gt;&lt;div class="login"&gt;
    &lt;div class="login_header"&gt;Login&lt;/div&gt;
&lt;input type="hidden" name="form_id" value="user_login_block" /&gt;
&lt;div class="form-item form-type-textfield form-item-name"&gt;
  &lt;label for="edit-name--2"&gt;Login &lt;span class="form-required" title="This field is required."&gt;*&lt;/span&gt;&lt;/label&gt;
 &lt;input type="text" id="edit-name--2" name="name" value="" size="15" maxlength="60" class="form-text required" /&gt;
&lt;/div&gt;
&lt;div class="form-item form-type-password form-item-pass"&gt;
  &lt;label for="edit-pass--2"&gt;Password &lt;span class="form-required" title="This field is required."&gt;*&lt;/span&gt;&lt;/label&gt;
 &lt;input type="password" id="edit-pass--2" name="pass" size="15" maxlength="60" class="form-text required" /&gt;
&lt;/div&gt;
      &lt;div class="forgot_password"&gt;
             &lt;a href="/" class="forgot_password"&gt;Forgot password&lt;/a&gt;
      &lt;/div&gt;
       &lt;input type="submit" name="" value="Log in" /&gt;
       &lt;a href="/" id="sign_up"&gt;Sign up&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;/form&gt;


How to remove extra &lt;div&gt; and put the form inside &lt;div class="login"&gt;? I tried that manually, but then I get 2 forms.
You could alter the form on the theme layer to wrap the form in a div...

/**
 * Implements hook_form_alter().
*/
function YOURTHEME_form_alter(&amp;$form, &amp;$form_state, $form_id) {

    //dsm($form_id);

    if ($form_id == 'YOURFORMID') {
        // add prefix and suffix to form
        $form['#prefix'] = '&lt;div class="form-class"&gt;';
        $form['#suffix'] = '&lt;/div&gt;';
    }
}