如何只在IE上破解css内联样式?

use*_*821 3 css internet-explorer

如何只在IE上破解css内联样式?

在所有版本中只能在IE上破解css内联样式,我该怎么办?

像那样

<div style = "
               color: #eee;
               border: 1px solid #000;
for ie only // line-height : 32px;     
             "/>
Run Code Online (Sandbox Code Playgroud)

Mr.*_*ien 5

您需要*在属性名称之前添加,并且仅针对IE7,因此您需要将其编写line-height : 32px;*line-height : 32px;

因为我意识到你想要每个IE浏览器,所以你走了

  • 对于IE6 - _
  • 对于IE7 - *
  • 对于IE8 - \0
  • 对于IE9 - \9

仅使用CSS声明IE10的样式

@media all and (-ms-high-contrast: none) { 
   /* This won't go inline but can be used at document level*/
   /* Declaration Blocks Goes Here*/
}
Run Code Online (Sandbox Code Playgroud)

您可以在此处阅读有关如何使用@media查询声明仅IE样式的更多信息


我仍然建议你使用条件注释,这将使你的生活更容易,而不是声明内联样式.