2012-04-12 45 views
5

を動作しない可能性の重複:
IE7 display issues (adding extra top margin)は、CSSマージントップIE7

だから私は、次のCSS

.socialMediaPlugin { 
width: auto; 
display: block; 
.socialMediaPluginFooter { 
margin-top: 15px; 
margin-bottom: -12px; 

}

とマークアップを持っています

 <div class="socialMediaPlugin socialMediaPluginFooter"> 
     <div class="socialMediaLinks"> 
     <a class="addthis_button_facebook"></a> 
     <a class="addthis_button_twitter"></a> 
     <a class="addthis_button_google_plusone_share"></a> 
     <a class="Pinterest"></a> 
     <a class="addthis_button_email"></a> 
     </div> 
    </div> 

そして、基本的にmargin-top:15px; socialMediaPluginFooterのIE7以外のすべてのブラウザで問題なく動作しますか?

+1

だ、その場合には、あなたのCSSで.socialMediaPluginのための不足している}タイプミスですか? – j08691

+0

IE7とIE8の違いはわかりません。どちらも、このようなマージンを表示していません、両方とも、入力ミスを修正します。それでは、jsFiddleにコードをいくつか表示できますか? –

答えて

12

margin-topはIE7では非常にバグです。親要素でpadding-topを使用してください。

http://reference.sitepoint.com/css/margin-top

+4

そして、「非常にバグがある」というのは、うまくいかないということです。 – iambriansreed

+0

あなたの答えのおかげで、非常に迷惑な問題を解決しました。ありがとう! –

3

あなたの問題は、あなたの不正な形式のCSSに由来する可能性があります。ここではそれがあるべき方法は次のとおりです。

.socialMediaPlugin { 
width: auto; 
display: block; 
} 
.socialMediaPluginFooter { 
margin-top: 15px; 
margin-bottom: -12px; 
} 

あなたはちょうどここにそれをミスタイプしてきた場合を除き、それは別の問題