【问题标题】:Exist any hack for IE6 and IE7?IE6 和 IE7 是否存在任何 hack?
【发布时间】:2011-11-02 17:53:43
【问题描述】:

如何以相同的表达式破解 IE6 和 IE7 的 CSS? (如果可能的话,当然)

-编辑-

我的意思是,

* html #div{   //hacks ie6}
*+html #div { //hacks ie7}

类似的表达方式会破解两者吗?

-edit2-

例如这个内联代码 HTML

    <!--[if IE lte 7]>

<style type="text/css"> 

.contButton p a{ height:25px; width:auto; }
.contButton p a span{ height:25px;width:auto; }  
</style>
<![endif]-->

只会影响 IE7 或更低版本,我如何在 CSS 中选择它???

示例:-*?? #div { //the CSS properties here will affect to IE6 and IE7 }

【问题讨论】:

  • "in [the] same expression"是什么意思
  • 我编辑了,如果我能更好地表达自己,请告诉我(请原谅我的英语)
  • mmmm.. 只会影响指定的浏览器
  • 再次编辑了我的问题;我问如果 -*??存在

标签: internet-explorer-7 internet-explorer-6


【解决方案1】:
  1. 使用条件样式表包括像

    <!--[if lte IE 7]>
    <link rel="stylesheet" type="text/css" media="all" href="ie_fixes.css" />
    <![endif]-->

  2. 或使用带有星号的肮脏解决方案(这会使您的样式表在验证者眼中无效)

    .example_class {
    *background-color: #ffffff;
    }

【讨论】:

  • 它仅适用于 IE8 之前的浏览器,但我不太确定 IE 5.5 及更低版本是否也会受到影响。
  • 不客气!请将我的帖子标记为已接受的答案,以将您的问题标记为已解决。谢谢你:)
【解决方案2】:

请改用conditional comments,这样您的“hack” CSS 将与您的“现代浏览器”CSS 分开:

<!--[if IE 7]>
    <style type="text/css" src="ie7styles.css" />
<![endif]-->

【讨论】:

  • 这不是我需要的……如果可能的话,我需要在样式表中这样做。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-21
  • 2010-11-05
  • 2011-03-07
  • 2010-10-20
相关资源
最近更新 更多