Simple HTML Form without Tables

example of a login form created without tables

This example is similar to quite a few CSS based forms that I've seen. It is pretty low on markup in the form itself, and the CSS is incredibly simple.

CSS:

form div label {
  float: left;
  clear: both;
  width: 125px;
}
 
form div input,
form div textarea {
  float: left;
  width: 125px;
  margin-bottom: 10px;
}
 
form div button {
  float: left;
  clear: both;
  margin-left: 125px;
}

HTML:

</p><form>
  <div>
    <label for="login_username">Username:</label>
    <input id="login_username" name="login_username" type="text" />
 
    <label for="login_password">Password:</label>
    <input id="login_password" name="login_password" type="text" />
 
    <button>Login</button>
  </div>
</form><p>

So, instead of moving the markup for the table cell(s) containing the inputs, if I wanted to move them a little, I could just make a couple of changes to the CSS. While the login form looks okay with this example, I just don't think that it is easily expanded into forms which would have even just a few more inputs and information: There are also issues of semantics. The <label></label> go some way to address this in the simple login form, but the detailed registration form cannot be dealt with in anything like as simple a method.

complex registration form without tables