Using absolute positioning on your error element will allow your form to remain unchanged on an error. This will however require additional markup to maintain your form display. In this example, a wrapper of <span class="item"></span>
was added to your input field to provide position boundaries for the error element.
Note that the properties set for the label
element will affect your error label as well.
See http://jsfiddle.net/K5fR8/3/ for an example.
Full markup as follows:
HTML
<form id="form" action="" method="post">
<p>
<label for="email">Email:</label>
<span class="item">
<input type="text" name="email" id="email" placeholder="Email" value="" class="required" />
</span>
</p>
<p>
<label for="password">Password:</label>
<span class="item">
<input type="password" name="password" id="password" placeholder="Password" value="" class="required" />
</span>
</p>
<p>
<label for=""></label>
<input type="submit" name="submit" id="submit" value="Log In" class="button" />
</p>
CSS
#form p label {
padding-top: 5px;
display: block;
width: 100px;
float: left;
}
#form p .item {
position: relative;
}
#form p .item label.error {
float: none;
position: absolute;
top: 0;
right: -100px; /* Offset by width set on label element */
padding: 0px;
}