2013-05-03 108 views
3

我有一個背景圖片,我試圖用作徽標。所有的罰款都在Chrome & FF中,但未在IE8中顯示。背景圖片根本無法加載。我如何讓他們在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; 
} 
+0

你使用html5shiv.js嗎? – Belyash 2013-05-03 02:29:50

回答

0

添加在您的網頁旁邊的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/

+0

Belyash,謝謝!謝謝!非常感謝!這解決了我的問題! – rbove 2013-05-03 13:57:39

0

header h1 a { 
    .... 
} 

需要line-height

+0

行高? =) – Belyash 2013-05-03 02:29:20

0

給出適當的浮動屬性。它正在影響它。