2014-02-13 52 views
0

我使用“css3饼”使我的网站兼容IE 8声明或包含“behavior:url(PIE.htc);”全球

贝娄是css代码,就像这个我使用几个类与各种设计。 behavior: url(PIE.htc);工作时,将其声明到每个类,但我应该在每个类中声明的CSS。我需要知道是否有可能宣布它为全球。

 .content { 
     -webkit-border-radius: 8px; 
     -moz-border-radius: 8px; 
     border-radius: 8px; 
     -webkit-box-shadow: #666 0px 2px 3px; 
     -moz-box-shadow: #666 0px 2px 3px; 
     box-shadow: #666 0px 2px 3px; 
     background: #EEFF99; 
     behavior: url(PIE.htc); //for making IE 8 compatible 

      }.content { 
     -webkit-border-radius: 8px; 
     -moz-border-radius: 8px; 
     border-radius: 8px; 
     -webkit-box-shadow: #666 0px 2px 3px; 
     -moz-box-shadow: #666 0px 2px 3px; 
     box-shadow: #666 0px 2px 3px; 
     background: #EEFF99; 
      } 
+0

我已经得到了张贴的问题的答案 * {behavior:url(pie/PIE.htc);} 如果在css文件中声明了这个,beh avior将被应用到所有在该css文件中使用的类。 – Rajesh

回答

0

您可以通过执行实现这一目标如下:

.content, .otherclass, .someclass { 
    behavior: url(PIE.htc); 
} 

如果你使用的无礼,你可以做到以下几点:

.cssPie { 
    behavior: url(PIE.htc); 
} 

.myFirstClass { 
    @extend .cssPie; 
    border-radius: 15px; 
} 

.mySecondClass { 
    @extend .cssPie; 
    box-shadow: 0 0 5px #000; 
} 
+0

谢谢你的答案,刚才得到了答案,它可以声明为'* {behavior:url(pie/PIE.htc);} '将行为应用于所有的css类。 – Rajesh

+0

@Rajesh请接受我的答案,如果你的开心。此外,我不建议您将此属性添加到通用选择器'*',因为这会导致严重的性能问题。 – enyce12