tags:

views:

36

answers:

1

I was looking for way to set position for inputs other than using tables. I googled this: Applying CSS to forms and I've made a test site: korran.ovh.org/test/test.html Text-type inputs looks good, but submit is moved a little to the left. Interesting thing is that if I set font-size: 10pt it looks perfect. But with default 12pt it's moved. So what's the problem here?

PS. I don't want to change positioning to px-based or with % ;)

+2  A: 

Ems are calculated based on the font-size of the parent element. Bumping up your font size from 10 to 12 is adjusting the value of the em, causing your submit button to move.

Try setting a different font-size on the parent element of the submit button to offset any changes that may be occurring in the cascade. Firebug is very helpful for showing both ems and what px value they are calculating to.

Mark Hurd
I know how ems works. But both text inputs (label: width: 4em; margin-right: 0.5em;) and submit (margin-left: 4.5em;) should be moved by 4.5em from the left side and be placed in the same vertical line.
bones87