tags:

views:

47

answers:

2
+1  Q: 

positioning span?

take a look at this validation demo:

http://jquery.bassistance.de/validate/demo/

the error messages are placed on the right side to the fields.

i have wrapped span on my messages and want to place them to the left side of the input fields. how do i do that with css?

+1  A: 

You just want to move them with CSS (that is, whithout changing where those elements occur in the HTML)? One way would be: position: relative; left: -120px; top:-20px (or whatever values you find put them where you want.

Tim Goodman
To clarify, I was looking at the validation messages on the upper group of fields . . . the lower ones look like there wouldn't be room to the left without moving some other things around . . . you could do `float:left` to bring them all the way to the left of the line and push the other stuff over . . . or just insert the elements in a different position to begin with (either in the HTML source for the page, or with JavaScript).
Tim Goodman
the problem is if i positioning them with pixels then longer error messages will cover the input fields while shorter error messages will be far from the input fields on the left side. they have to be right-positioned from the input fields. is that possible with css?
weng
If you can change the HTML of the page (as opposed to just applying CSS), I would try putting the error message and the corresponding input field in a div, then applying `float: left` to the error message. (If you don't contain it in a div, it will float all the way to the left of the line -- that is, even to the left of the "first name", "last name", etc. -- which I don't think is what you want.)
Tim Goodman
+1  A: 

if you want, you can hack the code on jquery.validate.js and look for this line:

label.insertAfter(element);

and change it to:

label.insertBefore(element);
Reigel
tried that, that will push the input elements to the right, and that is not what i want. but a good hack though:)
weng
I think you just need to css it... how about giving us some sample of the html... in a before and (should) after state of the desired output...
Reigel
Why would you hack it when jquery.validate allows you to customize the error placement yourself?
BBonifield
I would not hack it if it's me cause I can css it... the problem is this guy is not giving much info... that's the best answer I could think of for him now...
Reigel