【问题标题】:Wordpress featured images not showing up in IE8Wordpress 特色图片未在 IE8 中显示
【发布时间】:2012-05-21 08:30:44
【问题描述】:

我在使用 IE8 时遇到问题:它没有在此网站上显示特色图片:http://www.melisayavas.com/news/

这是我的functions.php中用于输出特色图片的代码:

if ( function_exists( 'add_theme_support' )) {
    add_theme_support( 'post-thumbnails' );
}

if ( function_exists('add_image_size')) {
    add_image_size('news-thumb', 200, 200);
}

这是用于特色图片的 CSS:

.post-thumb {
    float: left; 
    padding: 10px;
}

特别是对于 IE8,我有这个 CSS:

.post-thumb img {
    float: left\9;
    margin-top: 10px\9;
    margin-right: 10px\9;
}

如果我向.post-thumb element 添加边距或宽度,图像会显示在 IE8 上,但我不需要固定的宽度或高度。我不明白为什么它不拾取图像的宽度和高度。

【问题讨论】:

    标签: css wordpress internet-explorer-8


    【解决方案1】:

    您的代码将呈现为<img width="118" height="200"

    widthheight 没有 px。但是根据 Chrome 和 Firefox 的特性,它会自动读取为width="118px" height="200px"

    但是 IE 没有这个内置属性。这就是为什么它没有显示您的图像。

    尝试更新您的代码以将px 添加到图像大小。

    【讨论】:

      【解决方案2】:

      问题是由这条规则引起的:

      img, object, embed {
          max-width: 100%;
      }
      

      如果你从这条规则中删除img,图片将出现在IE8中。

      【讨论】:

      • 谢谢,确实是这样。非常感谢您的帮助。
      猜你喜欢
      • 2012-09-17
      • 2015-05-01
      • 1970-01-01
      • 2012-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-21
      相关资源
      最近更新 更多