HTML Form How to - Right align Login form








Question

We would like to know how to right align Login form.

Answer


<!--from  w  ww  .  j  a v a 2s  .com-->
<html>
<head>

<style>
fieldset {
  font-size: 12px;
  padding: 10px;
  width: 250px;
  text-align: right;
}
</style>
</head>
<body>

  <form name="frmExample" action="" method="post">
    <fieldset>
      <legend>Login details</legend>
      User name: <input type="text" size="12" name="txtUserName" /><br />
      Password: <input type="password" size="12" name="txtPassword" /><br />
      Confirm password: <input type="password" size="12"
        name="txtPasswordConfirmed" /><br /> <input type="submit"
        value="Log in" />
    </fieldset>
  </form>

</body>
</html>

The code above is rendered as follows: