【问题标题】:<!--[if IE]> Not working even though I'm sure I wrote it in correctly [duplicate]<!--[if IE]> 即使我确定我正确地写了它也不起作用[重复]
【发布时间】:2013-08-10 23:19:10
【问题描述】:

我为 IE 制作了这些,而为 IE 制作了一个。非 IE 显示在 IE 中和非 IE 显示。新的 IE 不支持这个还是我的 IE 搞砸了?我很确定我正确地写了这些,因为即使我正在阅读的书的资源也不起作用。还是这本书的作者我遗漏了什么。

这是我的作品:

For IE: <!--[if IE]><div class="ieFlow"><h1>Your Board</h1></div><![endif]-->
For not IE <!--[if !IE]--><div class="Flow"><h1>Your Board</h1></div><!--[endif]-->

这是本书的作品:

<!--[if IE]>
  <h1>You're using IE</h1>
<![endif]-->

都不行。

【问题讨论】:

    标签: html internet-explorer


    【解决方案1】:

    【讨论】:

    • D:有没有其他方法可以做类似的事情
    • 查看我的评论,您可以通过检测浏览器类型和版本来使用 javascript 来完成
    • 这取决于您要完成的工作,但功能检测是检测浏览器功能和调整功能的首选方法。
    • +1,@dc5。你最好有一个该死的充分的理由来使用浏览器黑客;它们脆弱且不可靠。 0, 1
    • 嗯,我的问题是我的文本在 IE 中显得非常大,所以我打算为它制作一个单独的文本大小。所以我认为特征检测不会起作用,因为它们都有显示文本的特征。
    【解决方案2】:

    请点击以下链接阅读条件样式表

    1. CSS TRICK

    2. Conditional Stylesheet for IE

    您可以使用这个 javascript 文件,CSS 浏览器选择器:http://rafael.adm.br/css_browser_selector/

    它允许您通过使用类名来定位特定的浏览器:

     .ie .example {
          background-color: yellow
        }
        .ie7 .example {
          background-color: orange
        }
        .gecko .example {
          background-color: gray
        }
        .win.gecko .example {
          background-color: red
        }
        .linux.gecko .example {
          background-color: pink
        }
        .opera .example {
          background-color: green
        }
        .konqueror .example {
          background-color: blue
        }
        .webkit .example {
          background-color: black
        }
    

    【讨论】:

    • 哪个不行,javascript解决方案?
    • 哦,等等,我必须得到他们的 javascript
    猜你喜欢
    • 1970-01-01
    • 2019-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-22
    • 2023-01-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多