【问题标题】:Background image not appearing in IE8IE8中没有出现背景图片
【发布时间】:2013-05-03 23:01:48
【问题描述】:

我有一张背景图片,我正尝试将其用作徽标。在 Chrome 和 FF 中一切正常,但在 IE8 中没有显示。背景图像根本不加载。如何让它们在 IE8 中显示?

这是代码:

<header>
    <h1 class="logo">
        <a href="http://publix.newhaven.edu/hlee-test">Henry C. Lee Institute of Forensic Science</a>
    </h1>    
</header>

css:

header {
    margin: 0 10px 38px 7px; 
    padding: 30px 0 0 0;
}
header h1{
    width:232px;
}
header h1 a {
    background:url('images/logo.png') 0 0 no-repeat; 
    display:block;
    height:89px;
    text-decoration:none; 
    text-indent:-9999px;
    width:243px;
}

【问题讨论】:

  • 你使用 html5shiv.js 吗?

标签: css image internet-explorer-8 background


【解决方案1】:

在你的页面下添加head

<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

在 css 中,您需要为新的 html5 标签编写默认样式:

header, footer, section, nav, article {
    display: block;
    margin: 0;
    padding: 0;
}

html5shiv.js - 在 DOM 中创建新的 html5 标签。像 IE8 这样的旧浏览器不知道 html5 标签。

https://code.google.com/p/html5shiv/

【讨论】:

  • 别利亚什,谢谢!谢谢你!太感谢了!这解决了我的问题!
【解决方案2】:

你的

header h1 a {
   ....
}

需要line-height

【讨论】:

    【解决方案3】:

    赋予适当的浮动属性。它正在影响它。

    【讨论】:

      猜你喜欢
      • 2014-03-25
      • 2012-07-12
      • 1970-01-01
      • 1970-01-01
      • 2011-01-29
      • 2021-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多