2014-12-05 47 views
0

這是我希望在改善CSS:應用CSS樣式到所有ie瀏覽器

img { 
    border-radius: 7px 90px 7px 7px !important; 
    @include pie; 
    .ie8 &{ 
     margin-left: 1px; 
     border-radius: 7px 90px 7px 7px; 
    }  
    .ie9 &{ 
     margin-left: 1px; 
     border-radius: 7px 90px 7px 7px; 
    }  
    .ie10 &{ 
     margin-left: 1px; 
     border-radius: 7px 90px 7px 7px; 
    }  
    .ie11 &{ 
     margin-left: 1px; 
     border-radius: 7px 90px 7px 7px; 
    }  
} 

是否有指定樣式的所有IE瀏覽器版本的方法嗎?而不是每個瀏覽器版本的1類?

我迄今發現的答案是:

  1. 哈克
  2. 應用 '如果' 條件HTML

請參閱此鏈接的詳細信息 - http://css-tricks.com/how-to-create-an-ie-only-stylesheet/

QUES:

  1. 除上述2之外是否還有其他解決方案?
  2. 有沒有人成功實施的黑客?他們不爲我工作。要麼打破造型,要麼什麼也不做!

謝謝! NEHA

+1

我寧願使用像一個特徵檢測器[近代化](http://modernizr.com/)。 – 2014-12-05 17:13:55

+1

使用此也許降級的任何IE版本IE8:''。 – 2014-12-05 17:28:56

回答

0

您是否嘗試過使用條件語句設置<html>標籤?

您可以將一個類到整個頁面:

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

然後設置你的CSS的規則應用到.ie

.ie{ 
    img{ /* ie only properties */ } 
} 
+0

[條件註釋在IE不再工作> 9](http://msdn.microsoft.com/en-us/library/ie/hh801214%28v=vs.85%29.aspx) – Rob 2014-12-05 17:17:43

+0

你可以添加類用JavaScript代替。 – CuddleBunny 2014-12-05 18:45:49