The problem lies partially in CSS declarations:
label.error { color: red; position:absolute; } label.error { float: left; right: 30px; color: #ff714d; position: absolute; font-family: 'subhead', helvetica, verdana; letter-spacing: 1px; text-transform: lowercase; }
Since position: absolute; - the last announcement (in positions v. float declarations), the element is positioned absolutely.
The first part of the problem is that, since the top property was not declared, but the display block label, the browser positions the top part on the next line down (where the top one will be in the static stream).
The second part of the problem is that since float declared, the browser is still trying to float element as well (which ends again when the browser positions the top on the next line down).
The solution (for now) is to remove the float declaration and declare top 0 in label.error styles.
label.error { color: red; position:absolute; } label.error { top: 0; right:30px; color: #ff714d; position: absolute; font-family: 'subhead', helvetica, verdana; letter-spacing: 1px; text-transform: lowercase; }
or in one ad:
label.error { color: red; position: absolute; right: 30px; top: 0; color: #ff714d; position: absolute; font-family: 'subhead', helvetica, verdana; letter-spacing: 1px; text-transform: lowercase; }
Updating the code for this is the ultimate problem, which is that all error messages are now displayed at the very top of the document.
This is caused by the declaration of position: absolute; , since elements that are absolutely located are removed from the normal document flow and placed (absolutely) in the nearest non-statically located anscestor element.
In this case, there are none, so the <label class="error" /> elements are absolutely located on <body /> . Thus, the final part of the solution is to ensure that the elements p not statically positioned (since errors should be absolutely marked there).
Final CSS:
p { position: relative; } label.error { color: red; position: absolute; right: 30px; top: 0; color: #ff714d; position: absolute; font-family: 'subhead', helvetica, verdana; letter-spacing: 1px; text-transform: lowercase; }
Updated (and working) script.