3

だから私はいくつかのcssドロップダウンメニューをIE7と8で動作させるようにしようとしてきました

それらは他のブラウザでうまく機能します。

サイトは: http: //hanling.focusww.com

cssのブロックがあり、IE7および8から非表示にしたい行がいくつか含まれています

最後に「*」で行をマークしました。

#menu a:visited {
  color:#f9f6e0;
  display:block;
  font-weight:700;
  padding-bottom:10px; //kill this in ie *
  padding-left:12px;
  padding-right:12px;
  padding-top:10px;  //kill this in ie *
}

誰かがこれを行う方法を説明する記事を私に指摘できますか?

4

3 に答える 3

7

あなたはそれを簡単な方法で行うことができますIE conditional comments

HTML

<!--[if IE 7]> <html class="ie7"> <![endif]-->
<!--[if IE 8]> <html class="ie8"> <![endif]-->

CSS

#menu a:visited {
  color:#f9f6e0;
  display:block;
  font-weight:700;
  padding-bottom:10px; //kill this in ie *
  padding-left:12px;
  padding-right:12px;
  padding-top:10px;  //kill this in ie *
}

.ie7 #menu a:visited,
.ie8 #menu a:visited, {
  padding-bottom: 0; //kill this in ie *
  padding-top: 0;  //kill this in ie *
}

CSS-Hacks..または、moreで可能:http : //www.webdevout.net/css-hacks#in_css

#menu a:visited {
 color:#f9f6e0;
 display:block;
 font-weight:700;
 padding-bottom:10px; 
 padding-bottom:0\9; //kill this in ie *
 padding-left:12px;
 padding-right:12px;
 padding-top:10px;  
 padding-top:0\9; //kill this in ie *
}
于 2012-12-14T17:53:31.133 に答える
1

私はこれを行います:

#menu a:visited {
 color:#f9f6e0;
 display:block;
 font-weight:700;
 padding-bottom:10px; 
 padding-bottom:0\9; //IE 8 and below
 padding-left:12px;
 padding-right:12px;
 padding-top:10px;  
 padding-top:0\9; //IE 8 and below

}

これらが必要なIE固有のスタイルだけである場合、これは条件付きスタイルシートを使用するよりもおそらく簡単です。

于 2012-12-14T18:01:05.787 に答える
1

IE の条件付きコメントを使用したり、特定のスタイルを IE から非表示にしたりできません。また、@yckart リンクを参照するのもクールですが、特定のスタイルシートを使用することをお勧めします。

<!--[if IE 7]>
    Only Shows Up In IE7
    <link href="#" rel="stylesheet" type="text/css" />
<![endif]-->

<!--[if IE 8]>
    Only Shows Up In IE8
    <link href="#" rel="stylesheet" type="text/css" />
<![endif]-->
于 2012-12-14T17:50:19.520 に答える