0

私は次の設定をしています:

<div style="position: fixed; margin: 0px; background-color: black; height: 100px; width: 100%;">
  <input type="text" style="position: absolute; display: block; left: 0px; top: 0px; bottom: 0px; right: 0px; margin: 30px 30px 15px 30px;" />
</div>

その意図は、タグを引き伸ばして、それを含む<div>タグのスペースを埋めることです (もちろんマージンは少なくなります)。<input>タグをタグに変更すると、これはすべての最新のブラウザーで機能します<div>が、ここに示すように、これは WebKit ブラウザー (Chrome および Safari) でのみ機能します。FF と IE9+ で目的の効果を得る方法はありますか (IE10 だけで十分です)。

4

2 に答える 2

2

入力に幅を%で指定してみてください....これはうまくいくでしょう

<div style="position: fixed; margin: 0px; background-color: black; height: 100px; width: 100%;">
  <input type="text" style="position: absolute; display: block; left: 0px; top: 0px; bottom: 0px; right: 0px; margin: 30px 5% 15px 5%;width:90%" />
</div>
于 2012-12-06T08:25:42.893 に答える
0

IE 7 以下をサポートする必要がない場合は、おそらく Box-sizing プロパティを使用できます: http://www.w3schools.com/cssref/css3_pr_box-sizing.asp

于 2012-12-06T09:32:55.903 に答える