2016-08-30 4 views
0

私はIEのみのCSSを対象とする簡単な方法を使用しています。IE条件付きCSSがFF&Chromeに入っています

<!--[if !IE]><!--> 
     <body> 
    <!--<![endif]--> 
    <!--[if IE]> 
     <body class="ie"> 
    <![endif]--> 


<div class="Out">My test content 
</div> 

外部CSS

.Out{ 
width:300px;/*Not for IE*/ 
} 
ie. Out{ 
width:300px; /*only for IE*/ 
} 

しかし、FFで&クロム開発ツール私は体が間違っているclass="ie"を得る見ていclass="ie"は、IEブラウザ専用です。

https://css-tricks.com/snippets/html/add-body-class-just-for-ie/

https://css-tricks.com/how-to-create-an-ie-only-stylesheet/

Detecting IE11 using CSS Capability/Feature Detectionenter link description here

http://www.positioniseverything.net/articles/cc-plus.html .....などのリストGOE:

は私が

リファレンスを参照している数の記事がありますs on

私は記事の番号を参照しましたが、助けにはなりません。私はいくつかのものを逃していると思います。

答えて

0

私は私の質問で述べたように、さまざまなソースと記事からたくさんのことを試しました。

幸い"SW4" in how-to-write-a-css-hack-for-ie-11

からの回答である私のためにどのような仕事IE 8,9および10

.Out { 
     width:400px\0; /*For IE 8,9 and 10.*/ 
     /* For me above code is also supporting in IE 11 also. However, for IE 10+ browser I have added media query using -ms-high-contrast below*/ 

     width: 300px; /*for other Browsers*/ 
     } 

ここでは本当にかなり単純な技術、です:-ms-使用してメディアクエリを作成するにはハイコントラストで、IE 10と11固有のCSSスタイルを配置します。 -ms-high-contrastはMicrosoft固有のものであり(Internet Explorer 10以降でのみ使用可能)、Internet Explorer 10以降でのみ解析されます。

-ms-high-contrastは、noneとactiveの2つの値をサポートします。したがって、プロパティの設定に関係なくIE10 +をターゲティングするには、次のメディアクエリを使用します。

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { 
width:400px; /* IE10+ CSS styles go here */ 
} 
関連する問題