【问题标题】:IE9 ignores font sometimesIE9 有时会忽略字体
【发布时间】:2014-08-07 07:29:11
【问题描述】:

我的 Web 应用程序使用 Arial 作为默认字体。但是在一个地方,字体系列被忽略了:

您可以看到左侧的标签使用 Arial,但在弹出的 DIV 中,它使用的是衬线字体(可能是 New Roman Times,我不确定。)

我已经直接设置了td 的样式,td 的内容只是一个空跨度加上文本。

当我切换右侧的复选框时,IE9 最终会重新计算样式并正确应用它们。

有谁知道为什么 IE 在这里忽略了 CSS?

详细信息:IE 9.0.29、Windows 7、ZK 6.5 作为 UI 框架。

【问题讨论】:

  • IE 是否忽略该选择器中的其他属性(例如color: red;)?您是否尝试过使用大写 A 的 Arial?它适用于其他字体吗?
  • @grc:请稍候,正在尝试...
  • background-color 有效。所有其他样式都被更强的样式覆盖(如预期的那样)。当我使用!important 时,它们也能正常工作。

标签: css internet-explorer internet-explorer-9


【解决方案1】:

我找到了这些解决方案,但我不知道为什么它们在继承不起作用时起作用:

.z-comboitem-text {
    font-family: Arial !important;
}

tr td.z-comboitem-text {
      font-family: Arial;
}

或使用内联样式。如果您使用 ZK 6,则使用此代码:

if( ZKUtils.isIE( 9 ) ) {
    item.setWidgetListener( "onBind", "jq(this).find('.z-comboitem-text').css('font-family', 'Arial')" );
}

public static boolean isIE( int version ) {
    Execution zkEnv = Executions.getCurrent();
    if( ! "ie".equals( zkEnv.getBrowser() ) ) {
        return false;
    }
    int actualVersion = zkEnv.getBrowser( "ie" ).intValue();
    return version == actualVersion;
}

【讨论】:

    猜你喜欢
    • 2011-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-19
    相关资源
    最近更新 更多