gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 09:27:09 25 4
gpt4 key购买 nike

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

仅在所有版本的 IE 上破解 css 内联样式,我该怎么做?

像那样

<div style = "
color: #eee;
border: 1px solid #000;
for ie only // line-height : 32px;
"/>

最佳答案

需要在属性名前加上*,这样只会针对IE7,所以需要把line-height : 32px;写成 *行高:32px;

因为我意识到你想要针对每个 IE 进行 hack,所以开始吧

  • 对于 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*/
}

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


我仍然建议您使用条件注释,这将使您的生活更轻松,而不是声明内联样式。

关于css - 如何仅在 IE 上破解 css 内联样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21238767/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com