【问题标题】:IE8 before content not displaying内容不显示之前的IE8
【发布时间】:2012-10-09 14:34:44
【问题描述】:

这里是违规页面的链接:http://www.wrightspecialty.com/brokers-agents-questionnaire.html?view=foxcontact

我使用的表单生成器有一个限制。无法插入文本,除非它是文本框、输入等的标签。IE9、Firefox、Safari 和 Chrome 都正确显示。 IE7不支持,IE8有限制。

所以我尝试使用 :before 伪选择器插入副本。对于 IE8 及以下版本,我使用的是 Google 的 javascript。这适用于 IE7 而不是 IE8

    <!--[if lt IE 9]>
        <script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script> 
    <![endif]-->

我将 css 中的每个元素作为目标:

    .foxcontainer_brokers div:nth-child(11):before, .foxcontainer_brokers div:nth-child(14):before, .foxcontainer_brokers div:nth-child(17):before, .foxcontainer_brokers div:nth-child(20):before, .foxcontainer_brokers div:nth-child(23):before, .foxcontainer_brokers div:nth-child(23):before, .foxcontainer_brokers div:nth-child(26):before, .foxcontainer_brokers div:nth-child(29):before {
        float: left;
        margin-left: 0;
        margin-bottom: 15px;
        padding-left: 3px;
        width: 100%;
        font-weight: bold;
        clear: both;
        font-size: 12px;
    }

    .foxcontainer_brokers div:nth-child(11):before {
        content: "Schools 8211 - Elementary and Secondary Schools";
    }

    etc...

有人有什么想法吗?提前致谢。

【问题讨论】:

    标签: javascript css internet-explorer-8 pseudo-element


    【解决方案1】:

    问题不在于您的:before 伪元素,IE8 确实支持该伪元素。它与您的 :nth-child() 伪类...和带有双冒号的 ::before 伪元素一起使用,这两者 IE8 都不支持。

    如果 IE9 脚本由于某种原因无法运行,也许您应该尝试类似 Selectivizr + 您选择的选择器库(例如 jQuery)。如果您尝试支持 IE8,您还应该避免使用双冒号作为伪元素,因为它不理解该语法。

    【讨论】:

    • Selectivizr + Google 的 IE9 脚本似乎可以解决问题。 IE8 的 Selectivizr 和 IE7 的 Google 脚本。
    【解决方案2】:

    IE8 不支持 css3 选择器(nth-child)

    【讨论】:

    • 我的错,我已经更新了上面的代码。我确实有它作为单个分号,但它仍然没有显示。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-19
    • 1970-01-01
    相关资源
    最近更新 更多