If you mean both of the textboxes aren't on the same line, it is because you put a <br /> in there to drop the second box to the 2nd line. Remove it and they will be on the same line.
If you mean you want to style them the same, then you can give them a class (class="blah") and use css to style that class the same.
If you mean that having "username" and password" beside the textboxes pushes one so they're not directly above each other, you can either wrap the text in a span tag (<span class="blah">Username</span>) and style that with a width, or you can use a table to align them properly.
The for attribute of the label is an accessibility feature; it allows the user agent to match label and input element pairs and give them appropriate behaviours. (For example, in most browsers, the input element will gain focus if its associated label is clicked.)
Note that the for attribute corresponds to the id of the input element, not its name; this is because multiple input controls can have the same name (such as radio buttons).
For some examples of styling forms (including aligning labels), take a look at this article: Applying CSS to forms
Strictly speaking, this is a misuse of the label markup. Instead, I would use the final paragraph element to display the error message, without a label element. In fact, I would go further and add the elements containing the error message at run-time, at the point when it needs to be shown.
Last edited by penagate; Feb 5th, 2012 at 12:21 AM.
@adqusit - .acs-span-medium is the CSS style element that you see in my post...
I recall having problems with labels - if empty they take no space? Span's worked better for me throughout the page work I've done. But not a lot of thought went into the login div I've got - I think I actually ripped it from some jQuery thread I found somewhere...
For what it's worth that gets put into a jQuery modal dialog pop up - code below - and images below. If I'm going to put something into some jQuery UI widget I prefer to have it contain all the elements it needs prior to calling the UI method...
I put a spinner-animation in the label - then either clear it or put up the log in failure message...