マークアップは次のようになります。
<div id="content">
<form action="...">
<input type="text" ... >
<input type="submit" ...>
</form>
<div id="forgotyourpassword">
Forgot your password?
</div>
</div>
フォームのマークアップはCMSによって生成されるため、変更することはできません。
content
divの幅と高さは固定されているため、ページ内で縦と横の中央に置くことができます。現在、 content
内のすべての子は display:inline-block
に設定され、
I have aligned the forgot your password link like this:

そして、ここに問題のリンクのためのCSSがあります:
#forgot-password{
float: right;
margin: 0; /* reset some stuff inherited from parent */
padding: 0; /* reset some stuff inherited from parent */
margin-right: 171px;
margin-top: -20px;
}
ここにいくつかの関連するCSSがあります:
#content{
position:absolute;
width: 650px;
left:50%;
top:50%;
height:242px;
margin-top:-126px;
margin-left: -325px;
text-align: center;
}
#content > *{
vertical-align: middle;
display: inline-block;
zoom:1;
*display:inline;
margin-left: 20px;
margin-right: 20px;
}
That all works well. However, in some cases, for example, if an error has occurred with the form submission, then an error message will be appended to the from in the <form>
element by the backend.
In such a case, I want the link to be aligned like so:

私のCSSの問題点は、パスワードを忘れた場合のリンクが親の content
の一番下から揃っていることです。ボタンとの相対的な位置合わせが必要です。
私の最初のアイデアは、パスワードを忘れたパスワード
のdivをフォームの下に並べることでした。したがって、エラーメッセージが追加されたときにフォームのサイズが変更されると、パスワードを忘れた
リンクが下にプッシュされます。
次に、 margin-top
を負のピクセル数に設定して、私のパスワードを忘れたパスワード
divをバックアップしてxピクセルにし、要素を送信ボタンnoフォームがどのくらい背の高いものになっているか
私はこれが当てはまらないことを発見しています:
- firefox 10では、
パスワードを忘れた
divは、フォームのコンテンツ領域と重なると、定義したピクセル分だけ「プッシュアップ」されていないようです。
- IE9では、
パスワードを忘れたパスワード
がフォームの上に表示されます!
ちょうどCSSを使ってこれをやり取りし、IE7以上とFirefoxで動作させる方法はありますか?