2

次のコードがあります。

 <style>
            .earthlogo{float: right; margin: -270px 0px 0px 0px;}
 </style>

    <div class="banner">   
        <p>ENVISIONING A BETTER TOMORROW</p> 
        <div class="earthlogo">
            <img src="images/earth.png"/>
        </div>
    </div>

ここで、負のマージンをクラスに適用しearthlogo、Firefox と Google Chrome では機能しますが、IE 7 では機能しません。これは、CSS で負のマージンを適用する正しい方法であり、正しい方法である場合、なぜ IE 7 で機能しないのですか? IE の問題を修正できますか。

ありがとう

4

2 に答える 2

2

負の代わりに、負またはオフセットと一緒にmargins使用できます。position: relative;topleft

.earthlogo {
     position: relative;
     top: -270px; /*pull it 270 pixels up*/
     left: 0px; /*we don't want to pull it to the left*/
     margin: 0px; /*make sure no margins are applied*/
}
于 2012-09-28T10:27:56.020 に答える
1

あなたが使用することができます

position: relative;

一緒に

 top:270px left:0px offsets
于 2013-07-09T11:57:52.537 に答える