tags:

views:

121

answers:

4

Hello,

Ive used the following css code to align my form elements:

form {  position:relative; }
form input { position:absolute; left:11em; }

However, the textarea element is not aligned correctly with the rest of the elements. I tried the following, but that didnt work

 form input,textarea { position:absolute; left:11em; }

Any way to fix this ?

Thank You.

A: 

No-one is going to be able to solve this without seeing the current result; I generally avoid absolute positioning as a rule unless doing something particularly complicated like tooltips, can you not achieve what you want using margins?

Steve
A: 

It looks like this is a Firefox, em-specific bug. I think it's related to this bug about Firefox textareas and its font: http://stackoverflow.com/questions/789479/mozilla-3-0-8-and-chrome-height-in-em-bug-workaround

Your positioning should work if you add the following code:

form { font: 11px Arial; }
form textarea { font-size: 100%; font-family: inherit; }

Also, another workaround is using pixels instead of em's.

richard
A: 

This does not address your question, but why not use "text-align"? Absolute positioning to place form elements sounds a bit odd in my ears.

Pekka
A: 

If you must use absolute positioning in this way, have you considered using margin instead of left? As the others have pointed out, it's difficult to troubleshoot your problem without more information.

Iain Fraser