Search code examples
htmlcssalignment

Form Alignment inputs


I am having an issue with aligning my password input box so its aligned with the email address input box any ideas?

**CSS:**
.column-right-login{
    background:url('../image/login.png') no-repeat;
    width:335px;
    height:154px;
    padding: 30px 0px 0px 10px; /* top right bottom left */
}

.column-right-login input{
    margin-left:15px;
}

.column-right-login a{
    color:#fff;
}

HTML:

<div class="column-right-login">
          <form action="http://www.thetradinghouse.co.nz/login" method="post" enctype="multipart/form-data" id="homeLogin">
             <div><label for="email">Email Address: </label> <input type="text" name="email" value="" /></div>
             <div><label for="password">Password: </label> <input type="password" name="password" value="" /></div>
              <a href="http://www.thetradinghouse.co.nz/forgot-password">Forgotten Password</a>
              <a onclick="$('#homeLogin').submit();" class="button"><span>Login</span></a>
          </form>
    <script type="text/javascript"><!--
    $('#homeLogin input').keydown(function(e) {
        if (e.keyCode == 13) {
            $('#homeLogin').submit();
        }
    });
    //--></script>   

</div>

Solution

  • This works, but I suggest you go read this article:

    http://www.alistapart.com/articles/prettyaccessibleforms

    .column-right-login{
        background:url('../image/login.png') no-repeat;
        width:335px;
        height:154px;
        padding: 30px 0px 0px 10px; /* top right bottom left */
    }
    
    form label {
        float:left;
        width:100px   
    }
    
    .column-right-login input {
        margin-left:15px;
        float:left;
    }
    
    form div {
       clear:both;    
    }
    
    .column-right-login a {
        color:#fff;
    }